gpt4 book ai didi

node.js - 为什么我的 ubuntu 服务器上的 npm 安装失败?

转载 作者:行者123 更新时间:2023-12-04 19:02:51 24 4
gpt4 key购买 nike

使用 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"
}
}

最佳答案

我最终以以下方式解决了这个问题:

  • 我知道问题出在 npm
  • 更新 Ubuntu:sudo apt-get update && sudo apt-get upgrade
  • Completely remove npm and all installed packages
  • 重新安装 npm
  • 此时,使用 npm install按预期工作。

  • 我不确定有什么更好的方法来实现这个结果,但很明显,我的 npm 安装中潜伏着某种错误,调试会比重新设置花费更长的时间。

    关于node.js - 为什么我的 ubuntu 服务器上的 npm 安装失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30905831/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com