问题
I'm having trouble to resolve this issue. I've searched around but not getting anywhere. I've just started learning MEAN Stack. I'm trying to install all components for the Stack. (I currently have programs installed for Python Stack and Ruby Stack). Not sure if those will have anything to do with my problem. I'm still new to programming. Any info would be greatly appreciated.
Here is what I'm running currently:
- MacOS Sierra v10.12.5
- Node v8.0.0
- npm v5.0.0
I've installed:
$ npm install nodemon
(-g)
..global was giving me a problem so I installed without it.
$ npm install bower
(-g)
..global was also giving me a problem so I installed without it.
Then when I tried to install:
$ npm install jquery
I was getting errors. Here is what it says..
npm WARN saveError ENOENT: no such file or directory, open '/Users/jaepark75/package.json' npm WARN enoent ENOENT: no such file or directory, open '/Users/jaepark75/package.json' npm WARN jaepark75 No description npm WARN jaepark75 No repository field. npm WARN jaepark75 No README data npm WARN jaepark75 No license field. npm WARN jaepark75 Invalid dependency: balanced-match undefined npm WARN jaepark75 Invalid dependency: block-stream undefined npm WARN jaepark75 Invalid dependency: brace-expansion undefined npm WARN jaepark75 Invalid dependency: concat-map undefined npm WARN jaepark75 Invalid dependency: fs.realpath undefined npm WARN jaepark75 Invalid dependency: fstream undefined npm WARN jaepark75 Invalid dependency: glob undefined npm WARN jaepark75 Invalid dependency: graceful-fs undefined npm WARN jaepark75 Invalid dependency: hammerjs undefined npm WARN jaepark75 Invalid dependency: inflight undefined npm WARN jaepark75 Invalid dependency: inherits undefined npm WARN jaepark75 Invalid dependency: materialize-css undefined npm WARN jaepark75 Invalid dependency: minimatch undefined npm WARN jaepark75 Invalid dependency: minimist undefined npm WARN jaepark75 Invalid dependency: mkdirp undefined npm WARN jaepark75 Invalid dependency: node-archiver undefined npm WARN jaepark75 Invalid dependency: once undefined npm WARN jaepark75 Invalid dependency: path-is-absolute undefined npm WARN jaepark75 Invalid dependency: rimraf undefined npm WARN jaepark75 Invalid dependency: tar undefined npm WARN jaepark75 Invalid dependency: wrappy undefined added 1 package in 2.742s
Thank you for taking the time to look at this.
回答1:
I had the same problem and after many errors it finally works. I deleted the files I had and restarted with these steps in the order stated:
Go to the directory you want to work in and create a folder named "node" for example
$ cd /directory/
$ mkdir node
You will need package.json so:
$ npm init
Then download express which creates node_modules where the download of jquery goes into
$ npm install express
Then install jQuery with a capital instead of without, i then tried without a capital after
$ npm install jQuery
Then npm install all other needed packages and
$ npm update
Hope this works for you :)
The link below contains a great step through of how to go from there, after it has been downloaded to using it:
https://code.tutsplus.com/tutorials/how-to-scrape-web-pages-with-nodejs-and-jquery--net-22478
回答2:
So first of all you should use cd C:\
and the Directory to where your server file will be. Then you need to use npm init
fill out all infos of your project. Then you can use the npm like above with npm install jquery --save
.
回答3:
This things happens because no package.json file in you directory. To avoid this error you have to install package.json file.
for that open cmd and type: npm init
this command asks some questions about project you can add this as default.
For complete guide watch this video: https://www.youtube.com/watch?v=SGxTzDgwaVU&t
来源:https://stackoverflow.com/questions/44359360/npm-install-jquery-error-saveerror-enoent-invalid-dependency