npm无法找到fstream模块 - Windows 10

时间:2017-09-18 18:57:33

标签: node.js npm windows-10

对于我尝试使用npm安装的任何内容,它返回相同的错误:找不到fstream模块。有趣的是,' fstream'进入我的NodeJS文件夹(C:/Program Files/nodejs/node_modules/npm/node_modules

我尝试重新安装,卸载并重新安装,安装其他nodejs版本,重新启动系统,什么都没有!

以下是尝试安装firebase工具的日志示例

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Checho\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'firebase-tools' ]
2 info using npm@5.3.0
3 info using node@v8.5.0
4 verbose npm-session 1f5a9f5441b96d8f
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 verbose stack Error: Cannot find module 'fstream'
7 verbose stack     at Function.Module._resolveFilename (module.js:527:15)
7 verbose stack     at Function.Module._load (module.js:476:23)
7 verbose stack     at Module.require (module.js:568:17)
7 verbose stack     at require (internal/module.js:11:18)
7 verbose stack     at Object.<anonymous> (C:\Users\Checho\AppData\Roaming\npm\node_modules\npm\node_modules\tar\lib\entry.js:14:15)
7 verbose stack     at Module._compile (module.js:624:30)
7 verbose stack     at Object.Module._extensions..js (module.js:635:10)
7 verbose stack     at Module.load (module.js:545:32)
7 verbose stack     at tryModuleLoad (module.js:508:12)
7 verbose stack     at Function.Module._load (module.js:500:3)
7 verbose stack     at Module.require (module.js:568:17)
7 verbose stack     at require (internal/module.js:11:18)
7 verbose stack     at Object.<anonymous> (C:\Users\Checho\AppData\Roaming\npm\node_modules\npm\node_modules\tar\lib\entry-writer.js:5:13)
7 verbose stack     at Module._compile (module.js:624:30)
7 verbose stack     at Object.Module._extensions..js (module.js:635:10)
7 verbose stack     at Module.load (module.js:545:32)
8 verbose cwd C:\Users\Checho\AppData\Roaming\npm-cache\_logs
9 verbose Windows_NT 10.0.14393
10 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Checho\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "firebase-tools"
11 verbose node v8.5.0
12 verbose npm  v5.3.0
13 error code MODULE_NOT_FOUND
14 error Cannot find module 'fstream'
15 verbose exit [ 1, true ]

1 个答案:

答案 0 :(得分:0)

我解决了! 只需将C:\Program files\nodejs\node_modules\npm\node_modules目录复制到C:\Users\{ my-user }\AppData\Roaming\npm\node_modules并替换所有文件即可。

是否存在全局文件所在的位置。但是在npm的最后一次更新中,肯定发生了一些错误。