Npm run dev dos不起作用

时间:2017-04-06 08:40:29

标签: node.js laravel npm-install

嘿,我是网络开发中的菜鸟,并试图用 Laravel Phaser 做事。 我正在运行Ubuntu Mint 18.1 Cinnamon(3.2.7)64位 我总是迷失在所有依赖的地狱^^“ npm run dev给我这个错误

NPM-的debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/home/guigeek/.nvm/versions/node/v4.0.0/bin/node',
1 verbose cli   '/home/guigeek/.nvm/versions/node/v4.0.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'dev' ]
2 info using npm@2.14.2
3 info using node@v4.0.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info predev @
6 info dev @
7 verbose unsafe-perm in lifecycle true
8 info @ Failed to exec dev script
9 verbose stack Error: @ dev: `node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (/home/guigeek/.nvm/versions/node/v4.0.0/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (/home/guigeek/.nvm/versions/node/v4.0.0/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:817:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid @
11 verbose cwd /home/guigeek/Dev/rf
12 error Linux 4.4.0-65-generic
13 error argv "/home/guigeek/.nvm/versions/node/v4.0.0/bin/node" "/home/guigeek/.nvm/versions/node/v4.0.0/bin/npm" "run" "dev"
14 error node v4.0.0
15 error npm  v2.14.2
16 error code ELIFECYCLE
17 error @ dev: `node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
17 error Exit status 1
18 error Failed at the @ dev script 'node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
18 error This is most likely a problem with the  package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
18 error You can get their info via:
18 error     npm owner ls
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

这是我的package.json

{
  "private": true,
  "scripts": {
    "dev": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "hot": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "production": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "devDependencies": {
    "axios": "^0.15.3",
    "bootstrap-sass": "^3.3.7",
    "jquery": "^3.1.1",
    "laravel-mix": "^0.8.8",
    "lodash": "^4.17.4",
    "vue": "^2.1.10"
  },
  "dependencies": {
    "webpack": "^2.3.3"
  }
}

感谢您的帮助

2 个答案:

答案 0 :(得分:1)

这是节点版本谢谢! 我使用NVM更新节点(https://github.com/creationix/nvm)并将其带到节点v7.9.0

答案 1 :(得分:0)

你必须尝试这个

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install