一、环境说明
操作系统:windows7
命令操作环境:cygwin
二、错误说明
在npm install grunt是出现报错:
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\ignore-by-default
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\livereload-js
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\lodash.defaults
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\minimatch
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\globule
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\gaze
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\chokidar
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\ps-tree
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\undefsafe
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\touch
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\faye-websocket
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\tiny-lr
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\nodemon
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\update-notifier
npm WARN checkPermissions Missing write access to G:\webstorm\movieManageWeb\node_modules\glob
npm WARN moviemanageweb@1.0.0 No description
npm WARN moviemanageweb@1.0.0 No repository field.
npm ERR! path G:\webstorm\movieManageWeb\node_modules\ignore-by-default
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access 'G:\webstorm\movieManageWeb\node_modules\ignore-by-default'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! d:\Program Files\nodejs\node_cache\_logs\2017-10-19T13_36_58_890Z-debug.log
三、问题解决
后面发现是因为我之前使用的是cnpm install grunt -g
使用的是cnpm在全局下安装的grunt。
后面又使用npm在当前文件目录下安装grunt,就出现了文件权限的问题。
所以我改成使用:cnpm install grunt --save-dev
问题就解决了。
cnpm是使用淘宝镜像安装,具体配置是:
npm install -g cnpm --registry=https://registry.npm.taobao.org
然后就可以使用cnpm安装模块了。