Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
587 views
in Technique[技术] by (71.8m points)

node.js - How to fix 'fs: re-evaluating native module sources is not supported' - graceful-fs

Recently I've made a switch to Node v.6, and It started creating more and more problems with running normal builds grunt/gulp/webpack

For example:

$ gulp
[14:02:20] Local gulp not found in ~/_Other/angular-2-ts/angular2-seed
[14:02:20] Try running: npm install gulp

while gulp and all other plugins and modules are installed (and even re-installed via rm -rf node_modules) in /node_modules folder.

Most of those errors have line like

(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.

with 42 as arbitrary number

Like in that issue I've submitted - in angular2-seed repo https://github.com/mgechev/angular2-seed/issues/902

What I've tried to do is downgrade to Node v.5 via n (https://www.npmjs.com/package/n) - it worked. Then remove all node_modules folders, then do

npm info graceful-fs -v
3.3.6

ok, lets upgrade or remove and install new:

npm i graceful-fs@latest
npm i [email protected]
sudo npm i [email protected] -g

all results in

npm info graceful-fs -v
3.3.6

So now I am currenlty stuck with graceful-fs 3.3.6 or even worse in some modules dependances, like

$ angular2-seed
$ npm install

//other lines..
npm WARN deprecated [email protected]: 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.

What could be the strategy here:

  • Manually patch all the deps that contain graceful-fs < 4.0.0?
  • There's some global switch to use specific package version?
  • Reinstall everything?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had this problem and I was able to fix this by updating npm

sudo npm update -g npm

Before the update, the result of npm info graceful-fs | grep 'version:' was:

version: '3.3.12'

After the update the result is:

version: '3.9.3'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...