【问题标题】:npm starting error on lite-serverlite-server 上的 npm 启动错误
【发布时间】:2017-10-16 20:08:49
【问题描述】:

嗯,我现在从 Angular 2 开始,在第一个快速入门示例中,我遇到了“npm start”这个问题:

C:\nodejs\apps\angular2\01-cadastro-contatos>npm start

> angular-quickstart@1.0.0 start C:\nodejs\apps\angular2\01-cadastro-contatos
> tsc && concurrently "npm run tsc:w" "npm run lite"

 Error occured when executing command: npm run lite
 Error: spawn cmd.exe ENOENT
     at exports._errnoException (util.js:1020:11)
     at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
     at onErrorNT (internal/child_process.js:376:16)
     at _combinedTickCallback (internal/process/next_tick.js:80:11)
     at process._tickCallback (internal/process/next_tick.js:104:9)
     at Module.runMain (module.js:606:11)
     at run (bootstrap_node.js:383:7)
     at startup (bootstrap_node.js:149:9)
     at bootstrap_node.js:496:3
 Error occured when executing command: npm run lite
 Error: spawn cmd.exe ENOENT
     at exports._errnoException (util.js:1020:11)
     at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
     at onErrorNT (internal/child_process.js:376:16)
     at _combinedTickCallback (internal/process/next_tick.js:80:11)
     at process._tickCallback (internal/process/next_tick.js:104:9)
     at Module.runMain (module.js:606:11)
     at run (bootstrap_node.js:383:7)
     at startup (bootstrap_node.js:149:9)
     at bootstrap_node.js:496:3
[1] npm run lite exited with code -4058

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\nodejs\\node.exe" "C:\\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 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-quickstart@1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
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!     tsc && concurrently "npm run tsc:w" "npm run lite"
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!     C:\nodejs\apps\angular2\01-cadastro-contatos\npm-debug.log

我尝试了很多在这个网站上找到的东西,但都没有成功。 我在 Windows 10 x64 上...

你能帮帮我吗?

【问题讨论】:

  • 您在运行这些命令之前是否执行过npm install?看起来所需的模块在您的本地 node_modules 中不可用
  • 是的,我以前做过。

标签: angularjs node.js npm lite-server


【解决方案1】:

首先全局安装这些包,如下所示:

npm install -g concurrently
npm install -g lite-server
npm install -g typescript

接下来,删除 node_modules 文件夹并运行 npm install。 然后重新运行 npm start 。如果失败,请打开 package.json(在您的项目目录中)并更改

"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" "

"start": "concurrently \"npm run tsc:w\" \"npm run lite\" "

如果它以某种方式无法正确转义引号,发生这种情况,请将其更改为:

"start": "concurrently "npm run tsc:w" "npm run lite" "

然后再次重新运行 npm start

【讨论】:

  • 请注意:如果您要将 concurrently lite-servertypescript 放入 npm 脚本中,则无需全局安装它们。将使用本地模块。
  • 没错,但我添加它以防万一他开始与 Ang 一起开发,并且可能在更多项目中需要这些包。投票赞成。
  • 编辑了答案,再试一次。如果一切都失败了,请完全重新安装节点并重新安装。由于 typescript 编译器或 Node 本身,这是一个错误。
猜你喜欢
  • 2020-09-24
  • 2020-06-19
  • 1970-01-01
  • 2017-01-29
  • 2020-09-25
  • 2016-11-01
  • 2020-07-21
  • 1970-01-01
  • 2017-07-26
相关资源
最近更新 更多