使用npm install
时,我的生产服务器上遇到错误 - 构建过程失败,出现以下错误:
npm WARN package.json app@0.0.0 No description
npm WARN package.json app@0.0.0 No repository field.
npm WARN package.json app@0.0.0 No README data
npm WARN package.json re-require@0.0.1 No repository field.
/
> phantomjs@1.9.17 install /src/frontend/node_modules/phantomjs
> node install.js
Download already available at /src/frontend/node_modules/phantomjs/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
Extracting tar contents (via spawned process)
Removing /src/frontend/node_modules/phantomjs/lib/phantom
Copying extracted folder /src/frontend/node_modules/phantomjs/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1434596446001/phantomjs-1.9.8-linux-x86_64 -> /src/frontend/node_modules/phantomjs/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /src/frontend/node_modules/phantomjs/lib/phantom/bin/phantomjs
npm WARN unmet dependency /src/frontend/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-parser requires debug@'0.7.4' but will load
npm WARN unmet dependency /src/frontend/node_modules/browser-sync/node_modules/socket.io/node_modules/debug,
npm WARN unmet dependency which is version 2.1.0
npm WARN unmet dependency /src/frontend/node_modules/gulp-jshint/node_modules/jshint requires lodash@'3.7.x' but will load
npm WARN unmet dependency /src/frontend/node_modules/lodash,
npm WARN unmet dependency which is version 3.9.3
npm WARN unmet dependency /src/frontend/node_modules/karma-browserify/node_modules/watchify/node_modules/browserify requires
through2@'^1.0.0' but will load
npm WARN unmet dependency /src/frontend/node_modules/karma-browserify/node_modules/watchify/node_modules/through2,
npm WARN unmet dependency which is version 0.6.5
npm WARN unmet dependency /src/frontend/node_modules/watchify/node_modules/browserify requires through2@'^1.0.0' but will load
npm WARN unmet dependency /src/frontend/node_modules/watchify/node_modules/through2,
npm WARN unmet dependency which is version 0.5.1
npm WARN unmet dependency /src/frontend/node_modules/watchify/node_modules/browserify requires xtend@'^3.0.0' but will load
npm WARN unmet dependency /src/frontend/node_modules/watchify/node_modules/xtend,
npm WARN unmet dependency which is version 4.0.0
bower-resolve@2.2.1 node_modules/bower-resolve
└── bower@1.4.1 (is-root@1.0.0, junk@1.0.1, stringify-object@1.0.1, user-home@1.1.1, chmodr@0.1.0, rimraf@2.4.0, abbrev@1.0.7, archy@1.0.0, opn@1.0.2, bower-logger@0.2.2, bower-endpoint-parser@0.2.2, graceful-fs@3.0.8, lru-cache@2.6.4, lockfile@1.0.1, nopt@3.0.2, retry@0.6.1, tmp@0.0.24, request-progress@0.3.1, q@1.4.1, chalk@1.0.0, which@1.1.1, shell-quote@1.4.3, bower-json@0.4.0, semver@2.3.2, fstream@1.0.6, p-throttler@0.1.1, promptly@0.2.0, mkdirp@0.5.0, glob@4.5.3, fstream-ignore@1.0.2, insight@0.5.3, tar-fs@1.5.1, update-notifier@0.3.2, decompress-zip@0.1.0, configstore@0.3.2, request@2.53.0, bower-registry-client@0.3.0, github@0.2.4, cardinal@0.4.4, mout@0.11.0, bower-config@0.6.1, handlebars@2.0.0, inquirer@0.8.0)
Error: Cannot find module 'module-deps'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/src/frontend/node_modules/browserify/index.js:1:75)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
奇怪的是,在相同的登台服务器上,使用相同的package.json,这个过程很顺利。我该如何调试这类问题?我的package.json如下:
"name": "app",
"version": "0.0.0",
"main": "gulpfile.js",
"devDependencies": {
"bower-resolve": "git+https://YPCrumble@github.com/YPCrumble/bower-resolve.git",
"browser-sync": "^2.7.11",
"browserify": "^10.2.4",
"browserify-shim": "^3.8.9",
"browserify-transform-tools": "^1.3.0",
"del": "1.2.0",
"envify": "^3.2.0",
"gulp": "3.9.0",
"gulp-concat": "2.5.2",
"gulp-jshint": "1.11.0",
"gulp-less": "^3.0.3",
"gulp-minify-css": "1.1.6",
"gulp-sourcemaps": "^1.3.0",
"gulp-uglify": "1.2.0",
"jasmine-core": "^2.2.0",
"jasmine-react-helpers": "^0.2.2",
"jshint-stylish": "^1.0.0",
"karma": "^0.12.31",
"karma-browserify": "^4.2.1",
"karma-chrome-launcher": "^0.1.7",
"karma-firefox-launcher": "^0.1.4",
"karma-jasmine": "^0.3.5",
"karma-phantomjs-launcher": "0.2.0",
"karma-safari-launcher": "^0.1.1",
"less-plugin-clean-css": "^1.5.0",
"lodash": "^3.3.0",
"re-require": "0.0.1",
"react": "0.12.2",
"react-tools": "^0.12.2",
"reactify": "1.0.0",
"sinon": "^1.12.2",
"vinyl-buffer": "1.0.0",
"vinyl-source-stream": "1.1.0",
"watchify": "^2.4.0"
},
"paths": {
"frontend": "./*.js",
"less": "./less/*.less",
"js": "./src/**/*.js",
"lint": "./*.js",
"jsx": "./src/**/*.jsx",
"app": "./app.js",
"vendor": "./vendor.js",
"html": "../templates/*.html",
"python": "../**/*.py"
},
"dest": {
"style": "style.css",
"app": "app.js",
"vendor": "vendor.js",
"dist": "dist"
},
"author": "",
"license": "ISC",
"browserify-shim": {
"jquery": "$",
"bootstrap": {
"depends": [
"jquery:jQuery"
],
"exports": "bootstrap"
},
"jquery-cookie": {
"depends": [
"jquery:jQuery"
]
},
"eonasdan-bootstrap-datetimepicker": {
"depends": [
"jquery:jQuery",
"moment:moment",
"bootstrap:bootstrap"
],
"exports": "$.fn.datetimepicker"
},
"image-picker": {
"depends": [
"jquery:jQuery"
],
"exports": "$.fn.imagepicker"
},
"raven-js": {
"depends": [
"jquery:jQuery"
],
"exports": "raven-js"
},
"parsleyjs": {
"depends": [
"jquery:jQuery"
],
"exports": "parsleyjs"
}
},
"browser": {
"jquery": "./bower_components/jquery/dist/jquery.js",
"jquery-cookie": "./bower_components/jquery-cookie/jquery.cookie.js",
"image-picker": "./bower_components/image-picker/image-picker/image-picker.js",
"eonasdan-bootstrap-datetimepicker": "./bower_components/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js",
"moment": "./bower_components/moment/moment.js",
"bootstrap": "./bower_components/bootstrap/dist/js/bootstrap.js",
"raven-js": "./bower_components/raven-js/dist/raven.js",
"parsleyjs": "./bower_components/parsleyjs/dist/parsley.js"
}
}
答案 0 :(得分:2)
我最终以下列方式解决了这个问题:
sudo apt-get update && sudo apt-get upgrade
npm install
按预期工作。我不确定是否有更好的方法来实现这一结果,但在我的npm安装中显然存在某种错误,调试所需的时间比执行此重置要长。