Angular 7 error when doing new app, Error: Cannot find module 'temp',
Angular 7 error when doing new app, Error: Cannot find module 'temp',
当我尝试使用以下方法开发新应用时:
ng new first-app
出现以下错误:
internal/modules/cjs/loader.js:589
throw err;
^
Error: Cannot find module 'temp'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
at Function.Module._load (internal/modules/cjs/loader.js:513:25)
at Module.require (internal/modules/cjs/loader.js:643:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\Junior\Documents\GitHub\angular-cli\lib\bootstrap-local.js:14:14)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
at Function.Module._load (internal/modules/cjs/loader.js:536:3)
我试图下载最后一个 node.js 和最后一个 npm 版本,也试图获取最后一个 angular cli 版本,但它给出了同样的错误。
我正在使用 Windows 并将应用程序放在桌面文件夹调用 Angular。
使用 ng -v 的 Cli 版本命令:
Cli version
已解决
我为解决这个问题所做的是 运行 使用位于 window 开始菜单中的 Node js 中的 Node.js 命令提示符的 Node js,而且我使用以下命令将我的 window 用户从 cmd 切换为管理员:
net user administrator /active:yes
See the Node.js command prompt
试试这些步骤
- 卸载@angular/cli
npm uninstall -g @angular/cli
- 清除 npm 缓存
npm cache clean --force
- 安装@angular/cli
npm i -g @angular/cli
这是当前节点的问题。
尝试通过 npm i -g temp
安装临时模块,然后 运行 ng new first-app
试试这个来添加缺少的临时模块条目:
npm i --save temp
如果您也遇到打字稿(或其他)问题,请使用以下行:
npm i --save-dev typescript
问题已解决。
我为解决这个问题所做的是 运行 使用位于 window 开始菜单中的 Node js 中的 Node.js 命令提示符的 Node js,而且我使用以下命令将我的 window 用户从 cmd 切换为管理员:
net user administrator /active:yes
当我尝试使用以下方法开发新应用时:
ng new first-app
出现以下错误:
internal/modules/cjs/loader.js:589
throw err;
^
Error: Cannot find module 'temp'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
at Function.Module._load (internal/modules/cjs/loader.js:513:25)
at Module.require (internal/modules/cjs/loader.js:643:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\Junior\Documents\GitHub\angular-cli\lib\bootstrap-local.js:14:14)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
at Function.Module._load (internal/modules/cjs/loader.js:536:3)
我试图下载最后一个 node.js 和最后一个 npm 版本,也试图获取最后一个 angular cli 版本,但它给出了同样的错误。
我正在使用 Windows 并将应用程序放在桌面文件夹调用 Angular。
使用 ng -v 的 Cli 版本命令:
Cli version
已解决
我为解决这个问题所做的是 运行 使用位于 window 开始菜单中的 Node js 中的 Node.js 命令提示符的 Node js,而且我使用以下命令将我的 window 用户从 cmd 切换为管理员:
net user administrator /active:yes
See the Node.js command prompt
试试这些步骤
- 卸载@angular/cli
npm uninstall -g @angular/cli
- 清除 npm 缓存
npm cache clean --force
- 安装@angular/cli
npm i -g @angular/cli
这是当前节点的问题。
尝试通过 npm i -g temp
安装临时模块,然后 运行 ng new first-app
试试这个来添加缺少的临时模块条目:
npm i --save temp
如果您也遇到打字稿(或其他)问题,请使用以下行:
npm i --save-dev typescript
问题已解决。
我为解决这个问题所做的是 运行 使用位于 window 开始菜单中的 Node js 中的 Node.js 命令提示符的 Node js,而且我使用以下命令将我的 window 用户从 cmd 切换为管理员:
net user administrator /active:yes