I am a fresher and started my career just 4 months back.
I am using Ubuntu and laravel for the development of my project.I am trying to compile a .js file for which i installed npm and bower in my project folder. Installation was smooth and is complete.
But while executing the "npm run dev" i am getting the below error.
I executed the below command :
sudo n latest And the error is :
npm run dev
> npm run development
> @ development /
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
events.js:167
throw er; // Unhandled 'error' event
^
Error: spawn node_modules/webpack/bin/webpack.js ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
at startup (internal/bootstrap/node.js:279:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:696:3)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
at onErrorNT (internal/child_process.js:407:16)
[... lines matching original stack trace ...]
at bootstrapNodeJSCore (internal/bootstrap/node.js:696:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vidya/.npm/_logs/2018-09-18T09_27_31_491Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vidya/.npm/_logs/2018-09-18T09_27_31_546Z-debug.log
Any help on this would be highly appreciated .
NPM version:6.4.1
bower version: 1.8.4
ubuntu version:UBUNTU 16.04 LTS
Steps To Reproduce:
Clean Laravel Installation ( composer create-project laravel/laravel webinterface)
run: composer install
run: npm install
run: npm run dev
Follow these steps:
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
Here is the link .
I used the below code in my root and the issue got fixed.
sudo npm install -g PACKAGE-NAME --unsafe-perm=false --allow-root
I used below to install all the packages.
sudo npm install -g --unsafe-perm=false --allow-root
Npm is working fine now.
Thanks for all your help.
应该将 webpack-dev-server 降级为:
npm install --save-dev webpack-dev-server@2.9.7
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.