在运行项目时出现npm问题

时间:2019-04-30 08:47:56

标签: javascript node.js reactjs npm node-modules

在使用npm start运行项目时,我一直遇到以下问题。即使将我的节点版本降级到8.4.0(npm版本5.3.0)后,仍然遇到相同的问题。我知道在stackoverflow和stackexchange中也存在同样的问题,并给出了许多解决方案。我尝试了所有方法,例如在删除 node_modules 之后运行npm cache clean --force,然后再次运行npm install之后,解决方案无法正常工作。我分享了以下日志:

> subhojits-components@0.0.1 start 
/home/subhojit/Desktop/myproject
> node server/index

Unspecified environment, booting dev server
Booting dev server....
module.js:491
throw err;
^

Error: Cannot find module 'internal/fs'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at evalmachine.<anonymous>:40:20
at Object.<anonymous> (/home/subhojit/Desktop/myproject/node_modules/express-handlebars/node_modules/graceful-fs/fs.js:11:1)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! subhojits-components@0.0.1 start: `node server/index`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the subhojits-components@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

注意:我使用的是graceful-fs 4.1.15版。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

尝试一下

sudo npm cache clean -f sudo npm install -g n sudo n stable