最近我切换到 Node v.6,它开始在运行正常构建 grunt/gulp/webpack 时产生越来越多的问题
例如:
$ gulp
[14:02:20] Local gulp not found in ~/_Other/angular-2-ts/angular2-seed
[14:02:20] Try running: npm install gulp
在/node_modules 文件夹中安装 gulp 和所有其他插件和模块(甚至通过 rm -rf node_modules
重新安装)。
大多数错误都有类似的行
(node:42) fs: re-evaluating native module sources is not supported.
If you are using the graceful-fs module,
please update it to a more recent version.
42 为任意数
就像我提交的那个问题一样 - 在 angular2-seed repo https://github.com/mgechev/angular2-seed/issues/902
我尝试做的是通过 n (https://www.npmjs.com/package/n) 降级到 Node v.5 - 它奏效了。然后删除所有 node_modules
文件夹,然后执行
npm info graceful-fs -v
3.3.6
好的,让我们升级或删除并安装新的:
npm i graceful-fs@latest
npm i graceful-fs@4.1.4
sudo npm i graceful-fs@4.1.4 -g
所有结果
npm info graceful-fs -v
3.3.6
所以现在我被 graceful-fs 3.3.6 卡住了,在某些模块依赖中甚至更糟,比如
$ angular2-seed
$ npm install
//other lines..
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before
will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0
as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
这里的策略是什么:
- 手动修补所有包含graceful-fs < 4.0.0的dep?
- 有一些全局开关可以使用特定的包版本吗?
- 重新安装所有内容?
最佳答案
我遇到了这个问题,我可以通过更新 npm
sudo npm update -g npm
更新前,npm info graceful-fs | 的结果grep '版本:'
是:
version: '3.3.12'
更新后的结果是:
version: '3.9.3'
关于node.js - 如何修复 'fs: re-evaluating native module sources is not supported' - 优雅的 fs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37346512/