Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
209 views
in Technique[技术] by (71.8m points)

javascript - How can i install npm moduls on atom?

I want to install the bcrypt package and im using the "npm install bcrypt --python=python2" and i can this after i run it: [email protected] install C:UsersUser ode_modulescrypt

node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download
[bcrypt] Success: "C:UsersUser
ode_modulescryptlibinding
api-v3crypt_lib.node" is installed via remote
npm WARN saveError ENOENT: no such file or directory, open 'C:UsersUserpackage.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:UsersUserpackage.json'
npm WARN User No description
npm WARN User No repository field.
npm WARN User No README data
npm WARN User No license field.

+ [email protected]
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.

question from:https://stackoverflow.com/questions/65862076/how-can-i-install-npm-moduls-on-atom

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...