简体   繁体   English

npm install找不到模块

[英]npm install cannot find module

# cat /etc/redhat-release
CentOS release 6.7 (Final)

When I run npm prune && npm install && bower install && gulp build 当我运行npm prune && npm install && bower install && gulp build

I get the error 我得到错误

> phantomjs@1.9.18 install /root/.builds/blog-theme/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/phantomjs
> node install.js

module.js:338
    throw err;
          ^
Error: Cannot find module '/root/.builds/blog-theme/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/phantomjs/install.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

> spawn-sync@1.0.13 postinstall /root/.builds/blog-theme/node_modules/gulp-sass/node_modules/node-sass/node_modules/cross-spawn/node_modules/spawn-sync
> node postinstall

module.js:338
    throw err;
          ^
Error: Cannot find module '/root/.builds/blog-theme/node_modules/gulp-sass/node_modules/node-sass/node_modules/cross-spawn/node_modules/spawn-sync/postinstall'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3
npm ERR! Linux 2.6.32-573.3.1.el6.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! phantomjs@1.9.18 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs@1.9.18 install script 'node install.js'.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/.builds/blog-theme/npm-debug.log

I'm running a new version of node and npm. 我正在运行新版本的node和npm。

# node --version
v0.12.7
# npm --version
2.11.3
# echo $NODE_PATH
/usr/local/lib/node_modules/

Here's my package.json 这是我的package.json

{
  "name": "blog-theme",
  "version": "1.0.8",
  "description": "Blog theme",
  "repository": {
    "type": "git",
    "url": "git://some.url.com/blog-theme.git"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "UNLICENSED",
  "private": true,
  "devDependencies": {
    "bower": "^1.4.1",
    "glob": "^5.0.10",
    "gulp": "^3.9.0",
    "gulp-autoprefixer": "^2.3.1",
    "gulp-bump": "^0.3.1",
    "gulp-filter": "^2.0.2",
    "gulp-git": "^1.2.4",
    "gulp-jshint": "^1.11.0",
    "gulp-load-plugins": "^0.10.0",
    "gulp-minify-css": "^1.1.6",
    "gulp-plumber": "^1.0.1",
    "gulp-rename": "^1.2.2",
    "gulp-sass": "^2.0.1",
    "gulp-sourcemaps": "^1.5.2",
    "gulp-tag-version": "^1.2.1",
    "gulp-uglify": "^1.2.0",
    "gulp-uncss": "^1.0.1",
    "jshint-stylish": "^0.4.0",
    "lodash": "^3.9.3"
  }
}

And bower.json 还有bower.json

{
  "name": "blog-theme",
  "version": "1.0.8",
  "description": "Blog theme",
  "license": "None granted",
  "private": true,
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "bootstrap-sass-official": "~3.2.0",
    "font-awesome": "~4.2.0"
  }
}

I'm definitely not a frontend developer and I've been stuck on this for about a day now. 我绝对不是前端开发人员,并且在此方面停留了大约一天。 What could the problem be? 可能是什么问题?

The problem seems to be that you don't seem to have Phantom JS installed. 问题似乎是您似乎没有安装Phantom JS。

Since you are on CentOS, as of the posting of this answer, according to the Phantom JS download page , it is recommended that you build the Linux version from source. 由于您使用的是CentOS,因此在发布此答案时,根据Phantom JS下载页面 ,建议您从源代码构建Linux版本。

Phantom JS for Linux 适用于Linux的Phantom JS

Binary packages for Linux are still being prepared. Linux二进制软件包仍在准备中。 There are still issues to be solved until a static build is available (see issue 12948 for more details). 直到有可用的静态版本,仍有一些问题需要解决(有关更多详细信息,请参见问题12948)。

In the mean time, it is recommended that you build the Linux version from source. 同时,建议您从源代码构建Linux版本。

http://phantomjs.org/download.html http://phantomjs.org/download.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM