Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am using npm #13

Open
dragonwong opened this issue Dec 25, 2017 · 0 comments
Open

I am using npm #13

dragonwong opened this issue Dec 25, 2017 · 0 comments
Labels

Comments

@dragonwong
Copy link
Owner

dragonwong commented Dec 25, 2017

只安装 dependencies 的依赖

(不安装 devDependencies 的依赖)

npm install --production

查看 link 情况

npm ls -g --depth=0 --link=true
# 下面这个不太管用
ls -l node_modules | grep '>' 

全局安装

sudo npm install -g <packageName>

如果还是提示权限问题,如:

gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/Users/wyz/Library/Caches/node-gyp/12.16.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@mtfe/mmp-cli/node_modules/@mtfe/dio/.node-gyp"

安装命令后增加 --unsafe-perm

查看全局安装

npm list -g --depth 0

全局一般安装在:/usr/local/lib/node_modules

卸载全局安装

npm uninstall -g <packageName>

忽略失败模块

如果我们遇到模块安装失败,但是这个失败并不阻塞后续流程,可以通过该方法忽略掉

将要忽略的模块加入 package.json 里的 optionalDependencies 字段

"optionalDependencies": {
  "fsevents": "*"
}

感谢:angular/angular-cli#8551 (comment)

查看包历史版本

npm view <packageName> time
@dragonwong dragonwong added the npm label Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant