简体   繁体   中英

Error when I try to run npm install

I'm just trying to do the first angular.js tutorial on the official website. When I try to run npm install from my project directory I get the following error.

在此处输入图片说明

My package.json file is given below.

 { "version": "0.0.0", "private": true, "name": "angular-phonecat", "description": "A tutorial application for AngularJS", "repository": "https://github.com/angular/angular-phonecat", "license": "MIT", "devDependencies": { "karma": "^0.12.16", "karma-chrome-launcher": "^0.1.4", "karma-jasmine": "^0.1.5", "protractor": "~1.0.0", "http-server": "^0.6.1", "tmp": "0.0.23", "bower": "^1.3.1", "shelljs": "^0.2.6" }, "scripts": { "postinstall": "bower install", "prestart": "npm install", "start": "http-server -a 0.0.0.0 -p 8000", "pretest": "npm install", "test": "node node_modules/karma/bin/karma start test/karma.conf.js", "test-single-run": "node node_modules/karma/bin/karma start test/karma.conf.js --single-run", "preupdate-webdriver": "npm install", "update-webdriver": "webdriver-manager update", "preprotractor": "npm run update-webdriver", "protractor": "protractor test/protractor-conf.js", "update-index-async": "node -e \\"require('shelljs/global'); sed('-i', /\\\\/\\\\/@@NG_LOADER_START@@[\\\\s\\\\S]*\\\\/\\\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\\\n' + cat('bower_components/angular-loader/angular-loader.min.js') + '\\\\n//@@NG_LOADER_END@@', 'app/index-async.html');\\"" } } 

Can someone help me to solve this problem. Thanks.

The messages are warnings, sometimes that just happens, and they often are uneeded anyway.
As long as the main components, Bower, Protractor, Karma etc are working, then I would try just carry on with the tutorial.

You can test they are working by running their commands, eg

./node_modules/.bin/bower help 

But

I think one issue I had with npm and running those commands is that they dont just run like the angular tutorial says.
So where the tutorial says, run this:

protractor test/protractor-conf.js

You might have to modify the command to this

./node_modules/.bin/protractor test/protractor-conf.js

Same with bower, karma etc

eg

put this in front of the commands

./node_modules./bin

the ./ says run this as a script and the path is so you access the scripts in the node_modules/.bin directories

Update
If you want to run a karma test:
First, make sure you are in the root directory of the project

./node_modules/.bin/karma start test/karma.conf.js  --single-run

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM