在Windows 7中重新启动npm启动错误

时间:2017-10-23 07:47:42

标签: angularjs node.js npm

如何重新解决这个问题。在这里我需要在窗口os 7 64位中重新解决问题。 我在Windows 7中安装了nodejs并打开了我输入的命令提示符

  

npm版

 'CALL "C:\Program Files\nodejs\\node.exe"
 "C:\ProgramFiles\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g' 
  is not recognized as an internal or external command,operable program or batch file.
 { 'angular-quickstart': '1.0.0',
    npm: '3.10.10',
   ares: '1.10.1-DEV',
      http_parser: '2.7.0',
      icu: '58.2',
     modules: '48',
    node: '6.11.4',
   openssl: '1.0.2l',
    uv: '1.11.0',
   v8: '5.1.281.108',
    zlib: '1.2.11' }

我创建项目文件夹我安装角度js当我安装npm它工作正常,但我得到了像

这样的命令
 E:\project\Demo>npm start
   'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules
    \npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external command,
     operable program or batch file.

    > angular-quickstart@1.0.0 prestart E:\project\Demo
    > npm run build


    npm ERR! Windows_NT 6.1.7601
    npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
   npm ERR! node v6.11.4
   npm ERR! npm  v3.10.10
   npm ERR! file C:\Windows\system32\cmd.exe;C:\xampp\php;
   npm ERR! path C:\Windows\system32\cmd.exe;C:\xampp\php;
   npm ERR! code ELIFECYCLE
   npm ERR! errno ENOENT
   npm ERR! syscall spawn C:\Windows\system32\cmd.exe;C:\xampp\php;
   npm ERR! angular-quickstart@1.0.0 prestart: `npm run build`
   npm ERR! spawn C:\Windows\system32\cmd.exe;C:\xampp\php; ENOENT
   npm ERR!
   npm ERR! Failed at the angular-quickstart@1.0.0 prestart script 'npm run build'.

        npm ERR! Make sure you have the latest version of node.js and npm installed.
       npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
     npm ERR! not with npm itself.
     npm ERR! Tell the author that this fails on your system:
     npm ERR!     npm run build
     npm ERR! You can get information on how to open an issue for this project with:
     npm ERR!     npm bugs angular-quickstart
     npm ERR! Or if that isn't available, you can get their info via:
     npm ERR!     npm owner ls angular-quickstart
     npm ERR! There is likely additional logging output above.
     npm ERR! Windows_NT 6.1.7601
     npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" 
    "C:\\ProgramFiles\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
    npm ERR! node v6.11.4
    npm ERR! npm  v3.10.10
    npm ERR! code ELIFECYCLE

    npm ERR! angular-quickstart@1.0.0 prestart: `npm run build`
    npm ERR! Exit status -4058
    npm ERR!
    npm ERR! Failed at the angular-quickstart@1.0.0 prestart script 'npm run build'.

   npm ERR! Make sure you have the latest version of node.js and npm installed.
   npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
   npm ERR! not with npm itself.
   npm ERR! Tell the author that this fails on your system:
   npm ERR!     npm run build
   npm ERR! You can get information on how to open an issue for this project with:
   npm ERR!     npm bugs angular-quickstart
   npm ERR! Or if that isn't available, you can get their info via:
   npm ERR!     npm owner ls angular-quickstart
   npm ERR! There is likely additional logging output above.

   npm ERR! Please include the following file with any support request:
   npm ERR!     E:\project\Demo\npm-debug.log

包json

    {
    "name": "angular-quickstart",
 "version": "1.0.0",
 "description": "QuickStart package.json from the documentation, supplemented with testing support",
  "scripts": {
  "build": "tsc -p src/",
  "build:watch": "tsc -p src/ -w",
  "build:e2e": "tsc -p e2e/",
  "serve": "lite-server -c=bs-config.json",
  "serve:e2e": "lite-server -c=bs-config.e2e.json",
  "prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
 "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
 "pretest:once": "npm run build",
 "test:once": "karma start karma.conf.js --single-run",
 "lint": "tslint ./src/**/*.ts -t verbose"
   },
 "keywords": [],
 "author": "",
 "license": "MIT",
"dependencies": {
"@angular/common": "~4.3.4",
"@angular/compiler": "~4.3.4",
"@angular/core": "~4.3.4",
"@angular/forms": "~4.3.4",
"@angular/http": "~4.3.4",
"@angular/platform-browser": "~4.3.4",
"@angular/platform-browser-dynamic": "~4.3.4",
"@angular/router": "~4.3.4",

"angular-in-memory-web-api": "~0.3.0",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
  "zone.js": "^0.8.4"
   },
 "devDependencies": {
"concurrently": "^3.2.0",
"lite-server": "^2.2.2",
"typescript": "~2.1.0",

"canonical-path": "0.0.2",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~4.0.14",
 "rimraf": "^2.5.4",
 "@types/node": "^6.0.46",
"@types/jasmine": "2.5.36"
   },
  "repository": {}
}

2 个答案:

答案 0 :(得分:0)

运行npm start执行npm i @级别之前,您拥有package.json 如果您有bower i

,也会执行bower.json

使用cmd中的SET检查环境变量中的节点。

答案 1 :(得分:0)

我在github上找到了this issue。显然,如果环境变量中存在错误,则会出现此错误。在Windows上打开PATH变量并检查对话框窗口中是否有任何奇怪的分号或标志:

dialog window

如果是,请修复它们并再试一次