每当我输入任何NPM命令时,都会出现此错误:
C:\Program Files (x86)\Microsoft Visual Studio 14.0>npm -v
internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module 'os-tmpdir'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\*I like my privacy*\AppData\Roaming\npm\node_modules\npm\node_modules\osenv\osenv.js:4:16)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
我尝试重新安装节点,但是我一直收到相同的错误。我注意到,如果我在设置的“添加或删除程序”页面中搜索NPM,则不会得到任何结果。
我的Node版本是v10.13.0
我正在使用Windows 10 Home 1803版
答案 0 :(得分:1)
我将删除节点:How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
然后使用以下NVM重新安装它:https://github.com/creationix/nvm
> nvm install 8.9.1
> nvm list // Will show you available NodeJS distribution
> 8.9.1
// So tell nvm to use your version
> nvm use 8.9.1
> nvm list
> * 8.9.1 (Currently using 64-bit executable)
> node -v
> 8.9.1