Yeoman Angular生成器无法在grunt serve上启动

6
当我使用 yeoman 设定 angular 生成器后,运行 grunt serve 后出现了以下错误:
module.js:340

    throw err;
          ^
Error: Cannot find module './lexer'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/var/www/angMaps/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/coffee-script.js:10:10)
    at Object.<anonymous> (/var/www/angMaps/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/coffee-script.js:167:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

路径"./lexer"正确吗?您能否发布module.js或您的app/server文件的代码? - user2539369
1
@Rockyy,我只需要按照这个链接 https://dev59.com/82cs5IYBdhLWcg3wPxnN#19023184 所述的步骤去操作,仅需删除node_modules文件夹并在该目录下运行npm install即可解决问题。 - Steve Birkner
2个回答

6

正如@SteveBirkner所提到的,删除node_modules目录并再次运行npm install命令。这样应该可以解决问题。


这对我不起作用!!还有其他解决方案吗?我已经尝试了所有已经找到的东西!即使是grunt -v也给我同样的错误。 - mohi

2

我遇到了同样的问题,在日志的结尾处,我收到了这样的消息:

...
http 200 http://registry.npmjs.org/-/all
Killed

问题出在我的虚拟机内存不够。一个解决方案是使用交换空间,这里提到了这里


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接