I want to install the bcrypt package and im using the "npm install bcrypt --python=python2" and i can this after i run it:
bcrypt#5.0.0 install C:\Users\User\node_modules\bcrypt
node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
[bcrypt] Success: "C:\Users\User\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node" is installed via remote
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\User\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\User\package.json'
npm WARN User No description
npm WARN User No repository field.
npm WARN User No README data
npm WARN User No license field.
+ bcrypt#5.0.0
updated 1 package and audited 130 packages in 2.951s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
I don't get any module in atom.
This is an error that tells you that current folder you are working in does not have a node project set up, its missing the necessary package.json file (every node project has one and needs one).
There are 2 types of "install" with npm, first is global that that you mark with -g flag (npm install bcrypt -g), this will install whatever package into global node modules that can be executed from the node command line, the second one is installing / adding it to your project.
In order to add anything to your project you need to create your project, create a folder for your project, open cmd line and navigate to the folder, and run npm init, this will create a package.json file (after you answer few questions), then npm install whatever will add the package automatically to the package.json file. (there is also a --save-dev flag that adds node module to dev dependencies)
Related
today i was trying to install my package in visual studio. But there is an error:
enter image description here
npm i
npm ERR! could not detect node name from path or package
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\holan\AppData\Local\npm-cache_logs\2021-09-01T00_08_12_922Z-debug.log
I reinstall node.js and python
here is my path
enter image description here
sorry for my bad english but i need help
As OP didn't provide details of the issue and seems to be new to nodejs, hereby explaining how npm i work in general matter.
There are main usage of npm i:
To install a package that haven't install in this project(or global) before, you can put that package name after the npm i , such as npm i express. Once the installation is done, it will insert the package name into package.json and the package source code in node_modules. You can think package.json is like a index and node_modules is the actual packages source code.
To install a package that listed in package.json. If you are copying/clone the project from other source , usually it has package.json but not the node_modules. In that case, you can use npm i to install all the packages that listed in package.json and it will then create the node_modules.
Using npm i without package.json will not install anything as there isn't a package name in the npm i [package name] and package.json .
I believe I need to build some binaries of a javascript image library (sharp js) and I have a docker command from the sharp js docs but it doesn't seem to be working properly
docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm install sharp
Source
I'm running this on win10. I just know docker basics btw. I get good output from npm but I don't see the libs anywhere.
$ docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm install sharp
> sharp#0.25.2 install /var/task/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.9.1/libvips-8.9.1-linux-x64.tar.gz
npm WARN saveError ENOENT: no such file or directory, open '/var/task/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/var/task/package.json'
npm WARN task No description
npm WARN task No repository field.
npm WARN task No README data
npm WARN task No license field.
+ sharp#0.25.2
added 76 packages from 154 contributors and audited 163 packages in 10.221s
2 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
This command keeps creating a directory called 'imageProcessing;C' that is empty. Alternatively is there a way I could just copy the libs found in the git repo into my node_modules folder somehow?
I'm trying to deploy the libs to Lambda using the serverless framework. Thanks!
Instead of "$PWD", typing in the full path in quotes worked:
docker run -v "//z/Dropbox/WD/Other Sites/ImageLambdas/imageProcessing":/var/task lambci/lambda:build-nodejs12.x npm install sharp
Also I found a Double Slash is required to start the host path
with the latest version of npm but i cant install compiler successfully.
ash#ubuntu:~/inbox$ node -v
v8.11.1
ash#ubuntu:~/inbox$ npm -v
5.8.0
ash#ubuntu:~/inbox$ sudo npm install --save solc
npm WARN saveError ENOENT: no such file or directory, open '/home/ash/inbox/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/ash/inbox/package.json'
npm WARN webpack-cli#2.0.14 requires a peer of webpack#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN inbox No description
npm WARN inbox No repository field.
npm WARN inbox No README data
npm WARN inbox No license field.
+ solc#0.4.21
updated 1 package in 5.593s
ash#ubuntu:~/inbox$
enter image description here
You're attempting to install into a project directory which will try to update the project's package.json file to add the dependency. The install still worked. You will find it under node_modules/solc.
The better approach is to install it globally:
npm install -g solc
After performing the commands cd C:\Users\USERNAME\Desktop\Lenny-Boio
and npm install discord.io winston --save I have been acquainted with the following message:
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\USERNAME\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\USERNAME\package.json'
npm WARN USERNAME No description
npm WARN USERNAME No repository field.
npm WARN USERNAME No README data
npm WARN USERNAME No license field.
+ discord.io#2.5.3
+ winston#2.4.0
updated 2 packages in 0.818s
I have node.js already installed.
Do you want to install a package for a specific project? If so, it's best to create a new directory for that project and run npm init first.
This creates a package.json file in your project directory, which contains your project's Node.js configuration and package dependencies (like discord.io and winston in your case).
You can find more information here: https://docs.npmjs.com/getting-started/using-a-package.json
I am trying to run npm install on my terminal as part of the setup for angular-phonecat as per the instructions on https://docs.angularjs.org/tutorial
When I run the command I am getting issues with deprecated modules and errors when reaching the bower install section.
Does anybody know how I can update the deprecated modules to avoid the warnings and how I can fix the bower errors?
Here is the output I am receiving:
npm WARN deprecated tough-cookie#2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated minimatch#0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
-
> fsevents#1.0.14 install /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/karma/node_modules/chokidar/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/karma/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
> angular-phonecat#0.0.0 postinstall /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat
> bower install
bower EACCES EACCES: permission denied, unlink '/Users/Eamon/.cache/bower/registry/bower.herokuapp.com/lookup/jquery_d223e'
Stack trace:
Error: EACCES: permission denied, unlink '/Users/Eamon/.cache/bower/registry/bower.herokuapp.com/lookup/jquery_d223e'
at Error (native)
Console trace:
Error
at StandardRenderer.error (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/renderers/StandardRenderer.js:81:37)
at Logger.<anonymous> (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/bin/bower.js:110:26)
at emitOne (events.js:77:13)
at Logger.emit (events.js:169:7)
at Logger.emit (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/bower-logger/lib/Logger.js:29:39)
at /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/commands/index.js:48:20
at _rejected (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:844:24)
at /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:870:30
at Promise.when (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:1122:31)
at Promise.promise.promiseDispatch (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:788:41)
System info:
Bower version: 1.7.9
Node version: 4.4.0
OS: Darwin 15.6.0 x64
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.0
npm ERR! npm v2.14.20
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat#0.0.0 postinstall: `bower install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat#0.0.0 postinstall script 'bower install'.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bower install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-phonecat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/npm-debug.log
I have tried searching on other posts with similar issues but none of these have helped me find a solution:
error when npm install
Got an error while running "npm install" on angular-phonecat directory
Cannot npm install for angular-phonecat tutorial : Cannot find module 'update-notifier'
I have also tried running sudo npm install with the same issue. I have a feeling the bower install issues are due to the setup of the bower cache looking at the error output but I am not 100% certain.
Has anyone encountered similar issues when setting up the installation for angular-phonecat?
Any help would be greatly welcomed.
Many Thanks,
Eamon
ISSUE: You (the user) don't have the right set of permissions for the directory.
The instant way out is to run the npm install using sudo, but this may give you the same error, or improper installation.
AND changing directory ownership is not a good option, a temporary patch. I am answering the question, as I feel I have a more elegant solution/suggestion to the problem. I came across same issues multiple times i.e. 'npm install -g #angular/cli'.
Uninstalled the package and executed the following commands (in the order mentioned) to have clean installation.
Solution/Suggestion: Change npm's Default Directory (from official docs)
Back-up your computer before moving forward.
(optional) In case you have a erroneous installation, first uninstall it:
npm uninstall <package-name> # use sudo if you used it while installation
npm cache verify # or, npm cache clean for npm version below 5.x.x
Make a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Open or create a ~/.profile or ~/.bash_profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables, or restart the terminal:
source ~/.profile
(optional) Test: Download a package globally without using sudo.
npm install -g jshint
Having looked into this it appears that bower was having issues with permissions and was resolved by running the bower install separately using sudo:
sudo bower install --allow-root
However, you should not use sudo with bower. It is likely that if you have to then the ~/.cache has been set incorrectly either by installing using sudo or installing your first package via sudo. More info about this can be found here: http://www.competa.com/blog/2014/12/how-to-run-npm-without-sudo/
Instead you should rectify the ownership by running the following:
sudo chown -R $user ~/.npm
sudo chown -R $user ~/.config
To find your user you can simply run the following command on the command line:
$ whoami
If you want to open to a wider group you can also add a group to the chown command. To find out which group your user belongs to you can type the following command:
$ groups
To set the group at the same time as the user simply change the command to the following and replace $user and $group with your desired user and group:
sudo chown -R $user:$group ~/.npm
sudo chown -R $user:$group ~/.config
If you are seeing an issue like one of the below when running a bower install during your npm install:
EACCES: permission denied, open '/some/directory'
EACCES: permission denied, unlink '/some/directory'
You will need to change the permissions to the folder containing the file to be your user by doing:
sudo chown -R USER /some/directory
Just change the folder that the file is stored in, not the file itself. When you run npm install after this it will work if it needs to install any bower components that are having issues installing while using your current user and not using sudo.
Thanks,
Eamon