【问题标题】:''Cannot find module" issues with Node.jsNode.js 的“找不到模块”问题
【发布时间】:2021-06-21 10:33:41
【问题描述】:

在最近生成的应用程序上使用“ionic serve”命令时遇到错误

[ng] The system cannot find the path specified.
[ng] internal/modules/cjs/loader.js:883
[ng]   throw err;
[ng]   ^
[ng] Error: Cannot find module 'C:\Users\shane\College\Year 2\Semester 2\Mobile Application Development\Ionic\@angular\cli\bin\ng'
[ng]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
[ng]     at Function.Module._load (internal/modules/cjs/loader.js:725:27)
[ng]     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
[ng]     at internal/main/run_main_module.js:17:47 {
[ng]   code: 'MODULE_NOT_FOUND',
[ng]   requireStack: []
[ng] }

[ERROR] ng has unexpectedly closed (exit code 1).

我曾多次尝试卸载 node.js、angular/cli 和 cordova ionic 并进行全新安装,但似乎没有任何效果。我迷失了从这里去的地方

【问题讨论】:

    标签: node.js angular ionic-framework


    【解决方案1】:

    这个错误表示设置了环境变量
    全局安装最新的 npm 包

    npm install -g npm@latest

    second thing is you follow this   
    Option 1: edit your Windows installation's PATH to put %appdata%\npm before %ProgramFiles%\nodejs.   Remember that you'll need to restart cmd.exe (and potentially restart Windows) when you make changes to PATH or how npm is installed.
    
    Option 2: remove both of
    
    %ProgramFiles%\nodejs\npm
    %ProgramFiles%\nodejs\npm.cmd
    

    【讨论】:

      猜你喜欢
      • 2011-07-14
      • 1970-01-01
      • 2013-08-10
      • 2019-05-12
      • 2012-01-02
      • 2017-02-18
      • 2012-12-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多