从C:\ nodejs卸载node.js并在Program Files \ nodejs中安装后,我在使用npm安装某些软件包时遇到问题
我之前从appdata文件夹中删除了npm cache和npm文件夹。 我正在使用他们网站上的最新官方节点版本。 我也尝试过使用chocolatey package nodejs.install ...
这是从控制台输出的:
C:\Users\My\Desktop>npm install -g gulp
npm ERR! Error: UNKNOWN, open 'C:\Users\My\AppData\Roaming\npm-cache\minimatch\0.3.0\package\package.json'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "gulp"
npm ERR! cwd C:\Users\My\Desktop
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! path C:\Users\My\AppData\Roaming\npm-cache\minimatch\0.3.0\package\package.json
npm ERR! code UNKNOWN
npm ERR! errno -1
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\My\Desktop\npm-debug.log
npm ERR! not ok code 0
C:\Users\My\Desktop>
尝试安装gulp后我成功安装了grunt
C:\Users\My\Desktop>npm install -g grunt
grunt@0.4.5 C:\Users\My\AppData\Roaming\npm\node_modules\grunt
├── dateformat@1.0.2-1.2.3
├── which@1.0.5
├── eventemitter2@0.4.13
├── getobject@0.1.0
├── colors@0.6.2
├── rimraf@2.2.8
├── async@0.1.22
├── hooker@0.2.3
├── grunt-legacy-util@0.2.0
├── exit@0.1.2
├── lodash@0.9.2
├── coffee-script@1.3.3
├── iconv-lite@0.2.11
├── underscore.string@2.2.1
├── minimatch@0.2.14 (sigmund@1.0.0, lru-cache@2.5.0)
├── glob@3.1.21 (inherits@1.0.0, graceful-fs@1.2.3)
├── findup-sync@0.1.3 (lodash@2.4.1, glob@3.2.11)
├── nopt@1.0.10 (abbrev@1.0.5)
├── grunt-legacy-log@0.1.1 (lodash@2.4.1, underscore.string@2.3.3)
└── js-yaml@2.0.5 (esprima@1.0.4, argparse@0.1.15)
C:\Users\My\Desktop>
答案 0 :(得分:1)
你试试这个吗?:
npm cache clear
我用这个命令解决了类似的问题。