npm phantomjsS明明是有的啊,npm install怎么报错了

Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. J it only takes a minute:
I am trying to globally install an npm module I just published. Every time I try to install, either from npm or the folder, I get this error.
npm ERR! Error: ENOENT, chmod '/usr/local/lib/node_modules/takeapeek/lib/cmd.js'
npm ERR! If you need help, you may report this log at:
&/isaacs/npm/issues&
npm ERR! or email it to:
npm ERR! System Linux 3.8.0-19-generic
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "takeapeek"
npm ERR! cwd /home/giodamlio
npm ERR! node -v v0.10.6
npm ERR! npm -v 1.3.6
npm ERR! path /usr/local/lib/node_modules/takeapeek/lib/cmd.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! Additional logging details can be found in:
/home/giodamlio/npm-debug.log
npm ERR! not ok code 0
I am using sudo and I have triple checked everything in the package everything should work. I did some searching around, and saw a couple of similer cases none of which have been resolved. Here is what I tried.
Upgrade npm (sudo npm install -g npm)
Clear the global npm cache (sudo npm cache clear)
Clear the user npm cache (npm cache clear)
I noticed that the error had to do with the file I am linking to the path, specifically when npm tried to do a chmod. That shouldn't be a problem, my lib/cli.js has normal permissions, and npm has superuser permissions during this install.
After digging through the npm docs I found an option that would stop npm from making the bin links(--no-bin-links), when I tried the install with it, it worked fine.
So what's the deal? Is this some
that has no solution yet?
Edit: For reference,
is the module I uploaded
15.4k15100162
1,74652249
Ok it looks like NPM is using your .gitignore as a base for the .npmignore file, and thus ignores /lib. If you add a blank .npmignore file into the root of your application, everything should work.
[edit] - more info on this behaviour here:
5,86312449
I ran into a similar problem,
npm cache clean
solved it.
25.8k93251
This problem somehow arose for me on Mac when I was trying to run npm install -g bower. It was giving me a number of errors for not being able to find things like graceful-fs. I'm not sure how I installed npm originally, but it looks like perhaps it came down with node using homebrew. I first ran
brew uninstall node
This removed both node and npm from my path. From there I just reinstalled it
brew install node
When it completed I had node and npm on my path and I was able to run
rm -rf ~/.npm
npm install -g bower
This then installed bower successfully.
Updating the brew formulas and upgrading the installs didn't seem to work for me, I'm not sure why. The removal of the .npm folder was something that had worked for other people, and I had tried it without success. I did it this time just in case. Note also that neither of the following solved the problem for me, although it did for others:
npm cache clean
sudo npm cache clean
I was getting this error on npm install and adding .npmignore did not solve it.
Error: ENOENT, stat 'C:\Users\My-UserName\AppData\Roaming\npm'
I tried going to the mentioned folder and it did not exist.
The error was fixed when I created npm folder in Roaming folder.
This is on Windows 8.1
I think your compiled coffee script is missing from the published npm package. Try writing a
In my case (multiple code ENOENT errno 34) problem was with ~/.npm/ directory access. Inside it there were some subdirs having root:root rights, which were causing problems while I run commands as normal user (without sudo). So I changed ownership of all subdirs and files inside ~/.npm/ dir into my local user and group. That did the trick on my Ubuntu (on Mac should work too).
$ sudo chown yourusername.yourgroupname ~/.npm/ -R
You should know your user name, right? If no then run $ whoami and substitute your group name with it too, like this:
$ sudo chown johnb.johnb ~/.npm/ -R
Test case:
From my local account /home/johnb I npm-installed globally some generator for yeoman, like this:
$ sudo npm install -g generator-laravel
Problem nature:
Above action caused some dependencies being installed inside ~/.npm/ dir, having root:root ownership (because of sudo ...). Evidently npm does not run as local user (or change dependencies subdirs ownership afterwards) when pulling dependencies and writing them to a local user subdir ~/.npm/.
As long as npm would be so careless against fundamental unix filesystem security issues the problem would reoccur.
Continuosly check if ~/.npm/ contains subdirs with ownership (and/or permissions) other than your local user account, especially when you install or update something with sodo (root). If so, change the ownership inside ~/.npm/ to a local user recursively.
Ask npm, bower, grunt, ... community that they address this issue as I described it above.
I tried all the stuff I found on the net (npm cache clear and rm -rf ~/.npm), but nothing seems to work. What solved the issue was updating node (and npm) to the latest version. Try that.
The same error during global install (npm install -g mymodule) for package with a non-existing script.
In package.json:
"module": "./bin/module"
But the ./bin/module did not exist, as it was named modulejs.
I got this error while trying to install a grunt plugin. i found i had an outdated version of npm and the error went away after updating npm to the latest version
npm install -g npm
5,12521426
In Windows I had a similar error.
Search paste App Data and search for the string npm.
I replaced the string 'npm' (including quotes) with 'npm.cmd' in both atlasboard\lib\package-dependency-manager.js and atlasboard\lib\cli\commands.js. That fixed the problem.
2,73452237
I had a similar issue with a different cause: the yo node generator had added "files": ["lib/"] to my package.json and because my cli.js was outside of the lib/ directory, it was getting skipped when publishing to npm.
(Yeoman issue at
it should be fixed soon.)
I was getting the error "Error: ENOENT, stat 'C:\Users\userName\AppData\Roaming\npm'. But there was no such directory. Created the directory and the npm install started working
I got a similar error message when trying to npm install a bunch of dependencies. Turns out some of them fail to install on Debian/Ubuntu because they expect /usr/bin/node to be the node executable. To fix, you need do
sudo ln -s nodejs /usr/bin/node
or better yet,
sudo apt-get install nodejs-legacy
For more info:
15.4k1876138
I had the same problem, and just found a handling not mentioned here. Though I'd contribute to the community:
npm install -g myapp was not copying the bin directory. I found this to be because I did not include it in the files in my package.json
"files": [
"bin" // this was missing
4,11832358
I recently upgraded to node 4.2.1 on a Windows 7 x64 machine. When running
npm install -g bower
I got a similar error:
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\THE_USERNAME\AppData\Local\Temp\npm-THE_HASH'
Thinking it was related to the AppData path, I played around with
npm config edit
npm config edit --global
to change the prefix, cache and tmp fields but received the same error with the new paths:
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\THE_USERNAME\npm-temp\npm-THE_HASH'
All commands were run as Administrator, so I had full permissions.
Then I thought there were some issues with existing files so I ran:
npm cache clean
But got the same error. However, there were still some temp files lying around. Manually removing all temp data with cygwin finally fixed the problem for me:
rm -rf bower bower.cmd node_modules etc
If you only have Windows cmd, you could use something like
rmdir /S THE_TEMP_DIR
to remove all subdirectories (although if you have deeply nested node dependencies, this is notoriously problematic)
So, maybe there is some issues with upgrading npm and having versions of bower or other packages hanging around. In my case that seemed to be the problem
I was getting a similar error on npm install on a local installation:
npm ERR! enoent ENOENT: no such file or directory, stat '[path/to/local/installation]/node_modules/grunt-contrib-jst'
I am not sure what was causing the error, but I had recently installed a couple of new node modules locally, upgraded node with homebrew, and ran 'npm update -g'.
The only way I was able to resolve the issue was to delete the local node_modules directory entirely and run npm install again:
cd [path/to/local/installation]
npm rm -rdf node_modules
npm install
Please try this
SET HTTP_PROXY=&proxy_name&
Then try that command.It will work
21.2k82759
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enablednodejs下載quint包時,下npm安装PhantomJS失败
出錯如下圖
還有一種情況是被牆了
報錯如下:
npm ERR! Exit status 8&
解决办法就是手动下载phantomjs-1.9.7-windows.zip,复制到C:\Users\ADMINI~1\AppData\Local\Temp\phantomjs\目录,再次执行npm install,安装成功,如下:
下载phantomjs-1.9.7-windows.zip必须挂代理或者VPN,比较麻烦,大家可以从网盘下载,里面包括各种系统下的版本。node js npm install Error: read ECONNRESET - 为程序员服务
node js npm install Error: read ECONNRESET
用npm安装phantomjs的时候,报以下错误:
events.js:72
// Unhandled 'error' event
Error: read ECONNRESET
..........省略............
网上说的原因有很多,经测试,是因为下载不到文件而报出的错误。如果能连网的话,很可能就是墙内,墙外的原因了。
解决办法:
npm config set registry=http://registry.npmjs.org
npm config set proxy=http://127.0.0.1:8087
1,将下载源的地址,由https://registry.npmjs.org改成http://registry.npmjs.org
2,http://127.0.0.1:8087是本地goagent的代理
--一步,二步,三步,N步,二行脚印
原文地址:, 感谢原作者分享。
您可能感兴趣的代码nodejs&npm&bootstrap配置
这里只说明如何在Windows下配置
第一步:安装git,然后配置Path环境变量,添加 git/bin 目录
第二步:下载nodejs,建议选用下载exe文件,然后配置Path环境变量,添加node.exe
第三步:安装npm,注意最好在以管理员权限运行
git config --system http.sslcainfo
/bin/curl-ca-bundle.crt
git clone --recursive git:///isaacs/npm.git
node cli.js install npm -gf
//检查是否安装成功
npm install -d
第四步:配置 npm&
配置npm的全局模块的存放路径以及cache的路径,例如我希望将以上两个文件夹放在NodeJS的主目录下,便在NodeJs下建立“node_global”及“node_cache”两个文件夹。我们就在cmd中键入两行命令:
npm config set prefix "D:\Program
Files\nodejs\node_global"
在系统变量下新建“NODE_PATH”,输入“D:\Program
Files\nodejs\node_global\node_modules”
npm config set cache "D:\Program
Files\nodejs\node_cache"
配置npm镜像,这里使用淘宝镜像
npm config set registry https://registry.npm.taobao.org
第五步:安装Bootstrap
第六步:安装Grunt
在全局环境中安装 grunt-cli :npm install -g grunt-cli 。
进入 /bootstrap/ 根目录,然后执行 npm install 命令。npm 将读取 package.json
文件并自动安装此文件中列出的所有被依赖的扩展包。
上述步骤完成后,你就可以运行 Bootstrap 所提供的各个 Grunt 命令了。
第七步:可用的 Grunt 命令
grunt dist (仅编译 CSS 和 JavaScript 文件)
重新生成 /dist/ 目录,并将编译压缩后的 CSS 和 JavaScript 文件放入这个目录中。作为一名
Bootstrap 用户,大部分情况下你只需要执行这一个命令。
grunt watch (监测文件的改变,并运行指定的 Grunt 任务)
监测 Less 源码文件的改变,并自动重新将其编译为 CSS 文件。
grunt test (运行测试用例)
在 PhantomJS 环境中运行 JSHint 和 QUnit 自动化测试用例。
grunt docs (编译并测试文档中的资源文件)
编译并测试 CSS、JavaScript 和其他资源文件。在本地环境下通过 jekyll serve 运行
Bootstrap 文档时需要用到这些资源文件。
grunt (重新构建所有内容并运行测试用例)
编译并压缩 CSS 和 JavaScript 文件、构建文档站点、对文档做 HTML5
校验、重新生成定制工具所需的资源文件等,都需要 Jekyll 工具。这些只有在你对 Bootstrap 深度研究时才有用。
如果你在安装依赖包或者运行 Grunt 命令时遇到了问题,请首先删除 npm 自动生成的 /node_modules/
目录,然后,再次运行 npm install 命令。
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。}

我要回帖

更多关于 npm install 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信