【问题标题】:Angular 2 — Error occured when executing command: lite-serverAngular 2 - 执行命令时发生错误:lite-server
【发布时间】:2017-06-16 02:19:48
【问题描述】:

我有这台机器,我安装了 Zsh 和 OhMyZsh,然后我卸载了它们。

现在,当我在 Angular 2 Quick Starter template 上运行“npm start”时,它会返回此错误:

Error occured when executing command: lite-server
 Error: spawn /usr/bin/zsh ENOENT
     at exports._errnoException (util.js:1022:11)
     at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
     at onErrorNT (internal/child_process.js:359:16)
     at _combinedTickCallback (internal/process/next_tick.js:74:11)
     at process._tickCallback (internal/process/next_tick.js:98:9)
     at Module.runMain (module.js:606:11)
     at run (bootstrap_node.js:394:7)
     at startup (bootstrap_node.js:149:9)
     at bootstrap_node.js:509:3
 Error occured when executing command: lite-server
 Error: spawn /usr/bin/zsh ENOENT
     at exports._errnoException (util.js:1022:11)
     at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
     at onErrorNT (internal/child_process.js:359:16)
     at _combinedTickCallback (internal/process/next_tick.js:74:11)
     at process._tickCallback (internal/process/next_tick.js:98:9)
     at Module.runMain (module.js:606:11)
     at run (bootstrap_node.js:394:7)
     at startup (bootstrap_node.js:149:9)
     at bootstrap_node.js:509:3
[1] lite-server exited with code -2

npm ERR! Linux 4.4.0-59-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v6.9.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! angular-quickstart@1.0.0 start: `tsc && concurrently "tsc -w" "lite-server" `
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the angular-quickstart@1.0.0 start script 'tsc && concurrently "tsc -w" "lite-server" '.
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 "tsc -w" "lite-server" 
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!     /home/hos4m/Workspace/angular2-spotify/npm-debug.log

从错误堆栈的第二行,我可以看到 Zsh 存在问题,但我不知道如何解决。

谢谢。

【问题讨论】:

    标签: angular npm zsh oh-my-zsh lite-server


    【解决方案1】:

    我在类似问题上使用了这篇文章的建议:Angular2 QuickStart npm start is not working correctly

    它说尝试更改 package.json 中的开头

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

    到:

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

    看看这是否适合你。

    【讨论】:

    • 查看你的依赖是否是最新的。运行“npm outdated”,然后运行“npm update”。抄送:stackoverflow.com/questions/36016905/…
    • 软件包是最新的。我删除了“node_modules”文件夹并运行“npm install”
    【解决方案2】:

    试试

    在您的快速入门目录中打开 2 个 cmd 实例:

    窗口 1# npm run build: 观看

    那么……

    窗口 2# npm 运行服务

    它将打开浏览器窗口并运行应用程序

    AngularJS2 npm start 错误信息

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-29
      • 2019-07-22
      • 2021-08-07
      • 1970-01-01
      • 2020-10-23
      • 2018-12-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多