V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
giordano008
V2EX  ›  Node.js

node 版本 v8.1.3,查看 npm -v 报错

  •  
  •   giordano008 · Jul 14, 2017 · 4171 views
    This topic created in 3210 days ago, the information mentioned may be changed or developed.

    RT $ npm -v module.js:487 throw err; ^

    Error: Cannot find module 'internal/fs' at Function.Module._resolveFilename (module.js:485:15) at Function.Module._load (module.js:437:25) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at evalmachine.<anonymous>:40:20 at Object.<anonymous> (C:\Users\dcz\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:1) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12)

    缺少'internal/fs'模块,但是安装还是有问题,npm -g install npm 大家是怎么解决的? PS:我用.msi 方式安装;但是 mac 系统的.pkg 安装后是没有问题的( npm -v 命令)

    3 replies    2017-07-26 18:54:36 +08:00
    gzlock
        1
    gzlock  
       Jul 14, 2017 via Android
    brew install node
    yangg
        2
    yangg  
       Jul 14, 2017   ❤️ 2
    建议使用 nvm 安装 node
    node 更换版本后需要将 node_modules 清空,重新 npm install
    maichael
        3
    maichael  
       Jul 26, 2017
    msi 安装,window 环境?

    一般报这个是因为有之前版本的 cache,清理一下就好了。参考这个

    https://stackoverflow.com/questions/40308623/cannot-find-module-internal-fs-afer-upgrading-to-node-7
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3274 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 13:56 · PVG 21:56 · LAX 06:56 · JFK 09:56
    ♥ Do have faith in what you're doing.