NPM安装错误

时间:2017-01-15 15:44:20

标签: node.js npm npm-install

运行npm install时,我收到的错误在其他计算机上无法重现。在安装完所有内容并运行webpack build之后,它会发出错误消息。在查看webpack应该安装的目录时,它甚至不存在。这是mac上已知的npm安装错误吗?

运行时出错 npm install

> www@ postinstall /Users/mackenzie/Desktop/omitted/www
> npm run webpack-build


> www@ webpack-build /Users/mackenzie/Desktop/omitted/www
> NODE_ENV=production ./node_modules/.bin/webpack -p --no-color

sh: ./node_modules/.bin/webpack: No such file or directory

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.4.0/bin/node" "/Users/mackenzie/Desktop/omitted/www/node_modules/.bin/npm" "run" "webpack-build"
npm ERR! node v7.4.0
npm ERR! npm  v3.10.9
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! www@ webpack-build: `NODE_ENV=production ./node_modules/.bin/webpack -p --no-color`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the www@ webpack-build script 'NODE_ENV=production ./node_modules/.bin/webpack -p --no-color'.
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 www package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     NODE_ENV=production ./node_modules/.bin/webpack -p --no-color
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs www
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls www
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/mackenzie/Desktop/omitted/www/npm-debug.log

npm WARN www@ No license field.
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.4.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.4.0
npm ERR! npm  v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! www@ postinstall: `npm run webpack-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the www@ postinstall script 'npm run webpack-build'.
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 www package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run webpack-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs www
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls www

的package.json

  "scripts": {
    "lint": "semistandard web/js/orders/* web/js/categories/* web/js/orders/* web/js/site/* web/js/user/*",
    "webpack-dev": "NODE_ENV=development ./node_modules/.bin/webpack --watch --progress",
    "webpack-build": "NODE_ENV=production ./node_modules/.bin/webpack -p --no-color",
    "postinstall": "npm run webpack-build"
  },
  "devDependencies": {
    "autoprefixer": "^6.5.2",
    "babel-core": "^6.18.2",
    "babel-loader": "^6.2.7",
    "babel-polyfill": "^6.16.0",
    "babel-preset-es2015": "^6.18.0",
    "babel-preset-react": "^6.16.0",
    "browser-sync": "^2.17.5",
    "browser-sync-webpack-plugin": "^1.1.3",
    "css-loader": "^0.25.0",
    "eslint": "^3.10.1",
    "eslint-config-semistandard": "^7.0.0",
    "eslint-config-standard": "^6.2.1",
    "eslint-config-standard-react": "^4.2.0",
    "eslint-loader": "^1.6.1",
    "eslint-plugin-promise": "^3.3.2",
    "eslint-plugin-standard": "^2.0.1",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.9.0",
    "less": "^2.7.1",
    "less-loader": "^2.2.3",
    "path": "^0.12.7",
    "postcss-loader": "^1.1.0",
    "semistandard": "^9.0.0",
    "style-loader": "^0.13.1",
    "url-loader": "^0.5.7",
    "webpack": "^1.13.3",
    "webpack-dev-middleware": "^1.8.4",
    "webpack-hot-middleware": "^2.13.1"
  },
  "dependencies": {
    "i": "^0.3.5",
    "lodash": "^4.16.6",
    "npm": "^3.10.9",
    "react": "^15.3.2",
    "react-addons-css-transition-group": "^15.3.2",
    "react-dom": "^15.3.2"
  }

2 个答案:

答案 0 :(得分:0)

选择NPM是不同的

npm ERR! npm  v3.10.9
npm ERR! npm  v4.0.5

答案 1 :(得分:0)

尝试: sudo npm install --unsafe-perm = true --allow-root

external link to solution建议