我使用了npm start命令。错误如下图所示。我想可能是版本问题。我的Node.jsVersion v10.16.3.
。删除包。从前端锁定文件和node_modeules
文件夹,然后运行此命令。
我一个接一个地运行这些命令
npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@11
再次出现同样的错误
@genesisui/angular@1.8.12 start D:>Node——max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve——0——host 0.0.0.0——proxy-conf proxy.conf.json
Node.js version v10.16.3 detected.
The Angular CLI requires a minimum Node.js version of either v14.15, or v16.10.
Please update your Node.js version or visit https://nodejs.org/ for additional instructions.
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! @genesisui/angular@1.8.12 start: `node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve --o --host 0.0.0.0 --proxy-conf proxy.conf.json`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the @genesisui/angular@1.8.12 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersDellAppDataRoamingnpm-cache_logs2022-06-27T04_09_42_465Z-debug.log
你应该完全删除你的NodeJS安装,并通过NVM重新安装。这将帮助你在多个NodeJS版本之间切换,并且对于每个活跃的NodeJS版本,你可以安装特定的Angular CLI版本。
例句:
nvm install 11
nvm install 12
nvm alias default 12
nvm use 11
npm install @angular/cli -g
- Mac/Linux: https://github.com/nvm-sh/nvm
- 窗口:https://github.com/coreybutler/nvm-windows
还可以在这里查看Angular CLI版本的一些详细信息附:如果你正在使用brew,按照以下步骤卸载NodeJS:
brew uninstall node;
# or `brew uninstall --force node` which removes all versions
brew cleanup;
rm -f /usr/local/bin/npm /usr/local/lib/dtrace/node.d;
rm -rf ~/.npm /usr/local/bin/node;