qiu8310 / smart-npm Goto Github PK
View Code? Open in Web Editor NEWAuto switch registry according your npm command.
Auto switch registry according your npm command.
[root@iZ23oir9az1Z ]# npm install --global smart-npm --registry=https://registry.npm.taobao.org/preinstall: cannot run in wd %s %s (wd=%s) [email protected] npm config set registry https://registry.npm.taobao.org/ /root/.nvm/versions/node/v6.0.0/lib/node_modules/.staging/smart-npm-ef71f992
npm WARN lifecycle [email protected]
/root/.nvm/versions/node/v6.0.0/bin/smart-npm -> /root/.nvm/versions/node/v6.0.0/lib/node_modules/smart-npm/bin/smart-npm.js
[email protected] postinstall /root/.nvm/versions/node/v6.0.0/lib/node_modules/smart-npm
node scripts/helper.js postinstall
fs.js:1083
return binding.unlink(pathModule._makeLong(path));
^
Error: EACCES: permission denied, unlink '/root/.nvm/versions/node/v6.0.0/bin/npm'
at Error (native)
at Object.fs.unlinkSync (fs.js:1083:18)
at postInstall (/root/.nvm/versions/node/v6.0.0/lib/node_modules/smart-npm/scripts/helper.js:89:34)
at Object. (/root/.nvm/versions/node/v6.0.0/lib/node_modules/smart-npm/scripts/helper.js:136:23)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Function.Module.runMain (module.js:575:10)
/root/.nvm/versions/node/v6.0.0/lib
└── (empty)
npm ERR! Linux 2.6.32-431.20.3.el6.x86_64
npm ERR! argv "/root/.nvm/versions/node/v6.0.0/bin/node" "/root/.nvm/versions/node/v6.0.0/bin/npm" "install" "--global" "smart-npm" "--registry=https://registry.npm.taobao.org/"
npm ERR! node v6.0.0
npm ERR! npm v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: node scripts/helper.js postinstall
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'node scripts/helper.js postinstall'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the smart-npm package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/helper.js postinstall
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs smart-npm
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls smart-npm
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/npm-debug.log
npm ERR! code 1
也不说是完全失败,没有报错,但是安装完成后运行hexo命令会找不到,用原生npm装就没有问题
npm install express --save
...
npm WARN saveError ENOENT: no such file or directory, open 'd:\node\package.json'
we must check into the path where npm locate
cd node_modules\npm
使用snpm以后是不是可以去掉.npmrc中的registry呢
registry=https://registry.npm.taobao.org
以下环境变量是不是也可以去掉了
export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/dist
export NVM_IOJS_ORG_MIRROR=https://npm.taobao.org/mirrors/iojs
奇怪的是,使用的淘宝的registry,npm search一用就报错,真不知道是为何。
正是由于这问题,才google到snpm。
请看下面的错误:
运行环境是 virtualbox, ubuntu 17.04 32bit, node v8.0.0, npm 5.0.3
edwin@edwin-VirtualBox:~$ sudo npm install --global smart-npm --registry=https://registry.npm.taobao.org/
> [email protected] preinstall /usr/local/lib/node_modules/smart-npm
> npm config set registry https://registry.npm.taobao.org/
npm ERR! path /usr/local/etc/npmrc
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open '/usr/local/etc/npmrc'
npm ERR! { Error: EACCES: permission denied, open '/usr/local/etc/npmrc'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: '/usr/local/etc/npmrc' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
┌─────────────────────────────────────────────────────────┐
│ npm update check failed │
│ Try running with sudo or get access │
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /home/edwin/.config │
└─────────────────────────────────────────────────────────┘
npm ERR! A complete log of this run can be found in:
npm ERR! /home/edwin/.npm/_logs/2017-06-14T12_57_16_538Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 243
npm ERR! [email protected] preinstall: `npm config set registry https://registry.npm.taobao.org/`
npm ERR! Exit status 243
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/edwin/.npm/_logs/2017-06-14T12_57_38_699Z-debug.log
'npm'不是内部或外部命令,也不是可运行的程序或批处理文件。
Branch | Build failing 🚨 |
---|---|
Dependency | snyk |
Current Version | 1.34.4 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
snyk is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
<a name"1.35.0">
The new version differs by 3 commits.
ff6e063
fix: support --dev when running in maven projects
b461b84
feat: support SBT package manager
387d537
fix: missing equal sign for the org parameter
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
windows下,生成的快捷方式直接指向的是smart-npm.js,如果windows的js默认不是由node.exe执行的话,那么就会出现安装后npm不能用的问题。
npm ERR! Error: EACCES: permission denied, open '/usr/local/etc/npmrc'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, open '/usr/local/etc/npmrc']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: '/usr/local/etc/npmrc' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
然,/usr/local/etc/下并没有npmrc文件。
OS:Centos 7.0
User:root
node version:v4.5.0
npm version:2.15.9
>snpm install-npm
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn npm ENOENT
at _errnoException (util.js:992:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
snpm可以在本地缓存过的情况下,优先读取本地缓存吗?
以及 npm 3.x
我更新了我的npm
~$ npm -v
5.0.2
不过snpm里的npm还是旧版本的
~$ snpm -v
npm: 4.4.4
smart-npm: 3.0.1
这样有什么影响么?我现在使用snpm的时候,用的是高版本的npm还是低版本的npm呀?
z at ZsMBP in ~
$ yarn global bin
/usr/local/bin
z at ZsMBP in ~
$ snpm
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn /Users/z/.config/yarn/global/node_modules/.bin/npm ENOENT
at exports._errnoException (util.js:1012:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
at onErrorNT (internal/child_process.js:348:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:577:11)
at run (bootstrap_node.js:352:7)
at startup (bootstrap_node.js:144:9)
at bootstrap_node.js:467:3
之前我把npm 的源换成淘宝的 也用了 smart-npm 速度确实要快很多 但是他会不定时的假死 就卡在那一直不动 等多久都不会动 挂vpn 都没用
我用 cnpm 嗖嗖的就装完了 但是cnpm 只能用来 自己install 包 像一些要使用npm的程序 还是要使用 npm 我现在3天了 像 create-react-app 这样的我就没有成功过
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.