Laravel-mix: npm run dev Error on fresh Laravel installation

Created on 5 Mar 2017  ·  50Comments  ·  Source: JeffreyWay/laravel-mix

Laravel version: 5.4.15
NodeJS version: 7.7.1
npm version: 4.1.2

Laravel/Homestead on Ubuntu 16.04

webpack.mix.js is default:

const { mix } = require('laravel-mix');

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css');

Error

vagrant@homestead:~/www/new$ npm run dev

> @ dev /home/vagrant/www/new
> node node_modules/cross-env/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

module.js:472
    throw err;
    ^

Error: Cannot find module '/home/vagrant/www/new/node_modules/cross-env/bin/cross-env.js'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:425:7)
    at startup (bootstrap_node.js:146:9)
    at bootstrap_node.js:540:3

npm ERR! Linux 3.19.0-25-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "dev"
npm ERR! node v7.7.1
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `node node_modules/cross-env/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`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ dev script 'node node_modules/cross-env/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'.
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  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node node_modules/cross-env/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
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs 
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls 
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/vagrant/www/new/npm-debug.log

Most helpful comment

@ibtissambth
Please try my steps.

Step1: composer update
Step2: rm -rf node_modules
Step3: npm cache clean
Step4: npm install
Step5: npm outdated
In this step, I update my laravel-mix version to 1.2.0, it is in the package.json.
Step6: npm install
Step7: npm run dev
After all these steps, everything is good.

All 50 comments

Duplicate #521

@dikiaap That configuration is already in new Laravel installation
This is package.json from Laravel 5.4.15 installed few hours ago:

{
  "private": true,
  "scripts": {
    "dev": "node node_modules/cross-env/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/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/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/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/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.1",
    "lodash": "^4.17.4",
    "vue": "^2.1.10"
  }
}

@dikiaap I find there solution. In node_module/laravel-mix/package.json should add this:

"bin": {
    "cross-env": "dist/bin/cross-env.js"
},

Replace Package.Json Content with the content from
https://github.com/laravel/laravel/blob/master/package.json

and then do npm install again.

For me I'm not that sure if upgrading to Node.js v7 from v4 helped but I just upgraded it, removed node_modules then run npm install. Afterwards running npm run dev becomes successful.

After updating PACKAGE.JSON., you can do NPM REBUILD. IT WORKS FOR ME.

Am also getting the same error after trying @nitin19srivastava solutions

Do the fresh LARAVEL installation, replace PACKAGE.JSON content with the link mentioned in above comment. Install NPM and then run NPM REBUILD.

If still not working, tell me your email or Dropbox I'd , so that I can do the same and forward​ it to you.

Its working now...!

Did you followed the above steps or any new step?

If new, please tell

I followed @jhunexjun solution... well am not very sure if his solution really did the magic but I also Replaced Package.Json Content with the content from
https://github.com/laravel/laravel/blob/master/package.json

and then did npm install again. I was still having some errors but this time it was a different one which npm failed to download somethings form github. Looking at the error I find out that it was because I was behind a proxy though I had the proxy configurations successfully set for npm but it still didn't work so I had to get another access to the internet without a proxy and this time it worked.

I tried everything on this thread but I get the following error

undefined:1625
    throw new JS_Parse_Error(message, filename, line, col, pos);
    ^
SyntaxError: Unexpected token: operator (>)
    at JS_Parse_Error.get (eval at <anonymous> (c:\xampp\htdocs\project_ski_new\node_modules\uglify-js\tools\node.js:27:1), <anonymous>:86:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=production 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.

This is the function registered on that file at that line

new Function("MOZ_SourceMap", "exports", FILES.map(function(file){
    return fs.readFileSync(file, "utf8");
}).join("\n\n"))(
    require("source-map"),
    UglifyJS
);

node -v 8.0.0
npm -v 5.0.0

EDIT: it works fine, but only in development. If I switch to production I get the error above mentioned

Updating node from 4.x to latest fixed this for me.

My node is v8.1.4, npm is 5.0.3
I tried everything on this thread but I still have the following error

npm ERR! code ELIFECYCLE
npm ERR! errno 2
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 2
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.

Replace Package.Json Content with the content from
https://github.com/laravel/laravel/blob/master/package.json

and then do npm install again.

I replace it, it still has the same issue.

AFTER replacement, you did npm install??

Yes, I did it. It still has the same issue.
You can try to install the lateest laravel and install npm, and you will find it always happen.

Hí, Ramseyjiang.

Step 1- Do fresh LARAVEL project download.
Step 2- Replace package.json content , with the content from the link provided above.
Step 3- Through command prompt - npm install --no-bin-links
Step 4- Through command prompt - npm rebuild

It worked for me.

@nitin19srivastava I have done all things you told me. But it still not works.

hello please i have a problem i did everything but all my files .vue have a white text witouth color!!! and npm run dev doesnt work for me

Can we meet over Skype. To see the problem.

I don't know what's problem. But you can try install a fresh laravel and then install npm, after that run command: npm run dev. I think you can meet the issue.

@nitin19srivastava I fixed it that issue by myself way.

Step1: composer update
Step2: rm -rf node_modules
Step3: npm cache clean
Step4: npm install
Step5: npm outdated
In this step, I update my laravel-mix version to 1.2.0, it is in the package.json.
Step6: npm install
Step7: npm run dev
After all these steps, everything is good.

@ibtissambth
Please try my steps.

Step1: composer update
Step2: rm -rf node_modules
Step3: npm cache clean
Step4: npm install
Step5: npm outdated
In this step, I update my laravel-mix version to 1.2.0, it is in the package.json.
Step6: npm install
Step7: npm run dev
After all these steps, everything is good.

Thank you...i LL try it

this kind of error always occur when you add a comment like this in the package.json
//this is a comment
so remove any comments like the above.

@ibtissambth Thanks I tried it and it worked for me

I had a similar issue and was able to fix it by updating NodeJS to at version 6.0 or above.

Hi all,

I've folllowed @ibtissambth steps but still get error

this is the log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.4.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'development' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predevelopment', 'development', 'postdevelopment' ]
5 info lifecycle @~predevelopment: @
6 info lifecycle @~development: @
7 verbose lifecycle @~development: unsafe-perm in lifecycle true
8 verbose lifecycle @~development: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/gama/Workspace/web/gama.web.id/node_modules/.bin:/usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/gama/Workspace/web/gama.web.id/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS:/Users/gama/Workspace/go:/Users/gama/Library/Android/sdk/tools:/Users/gama/Library/Android/sdk/platform-tools:/usr/local/Cellar/graphicsmagick/1.3.26_1/bin
9 verbose lifecycle @~development: CWD: /Users/gama/Workspace/web/gama.web.id
10 silly lifecycle @~development: Args: [ '-c',
10 silly lifecycle   'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
11 silly lifecycle @~development: Returned: code: 2  signal: null
12 info lifecycle @~development: Failed to exec development script
13 verbose stack Error: @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid @
15 verbose cwd /Users/gama/Workspace/web/gama.web.id
16 verbose Darwin 16.7.0
17 verbose argv "/usr/local/Cellar/node/8.4.0/bin/node" "/usr/local/bin/npm" "run" "development"
18 verbose node v8.4.0
19 verbose npm  v5.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 2
23 error Failed at the @ development script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

this is package.json

{
    "private": true,
    "scripts": {
        "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",
        "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "axios": "^0.16.2",
        "bootstrap-sass": "^3.3.7",
        "cross-env": "^5.0.1",
        "jquery": "^3.1.1",
        "laravel-mix": "^1.2.0",
        "lodash": "^4.17.4",
        "vue": "^2.1.10"
    }
}

Anyone have similiar issue?

Homestead user on Mac here - I tried everything that I found everywhere, and eventually decided to start fresh. So I upgraded Virtual Box, Vagrant and a fresh install of Homestead, then delete my node_modules folder and did a
npm install
and now it's finally working. I only wasted like 4 hours.

rebuild your npm

npm rebuild

I struggled a lot with this issue but when I used Yarn everything is resolved:

yarn install

Simplemente utilice el comando
npm rebuild
y todo ok

i do all thing but i have this problem

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! C:\Users\Baye Niasse\AppData\Roaming\npm-cache_logs\2018-04-10T17_25_08_074Z-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! C:\Users\Baye Niasse\AppData\Roaming\npm-cache_logs\2018-04-10T17_25_08_127Z-debug.log
PS C:\Users\Baye Niasse\Documents\dilun>

Hi,
Maybe, you should try YARN.
Then execute these commands:
    > yarn install

    > yarn watch

Good luck!!!

Le mardi 10 avril 2018 à 18:26:33 UTC+1, amadoutidiane <[email protected]> a écrit :

i do all thing but i have this problem

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! C:\Users\Baye Niasse\AppData\Roaming\npm-cache_logs\2018-04-10T17_25_08_074Z-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! C:\Users\Baye Niasse\AppData\Roaming\npm-cache_logs\2018-04-10T17_25_08_127Z-debug.log
PS C:\Users\Baye Niasse\Documents\dilun>


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

I try all of this after that I have show this problem what to do ? working on laravel 5.6

$ npm install

[email protected] install E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\node-sass
node scripts/install.js

Cached binary found at C:\Users\Afroza\AppData\Roaming\npm-cache\node-sass\4.9.0\win32-x64-57_binding.node

[email protected] postinstall E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\node-sass
node scripts/build.js

Binary found at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\node-sass\vendor\win32-x64-57\binding.node
Testing binary
Binary is fine

[email protected] postinstall E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\gifsicle
node lib/install.js

√ gifsicle pre-build test passed successfully

[email protected] postinstall E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\mozjpeg
node lib/install.js

√ mozjpeg pre-build test passed successfully

[email protected] postinstall E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\optipng-bin
node lib/install.js

√ optipng pre-build test passed successfully

[email protected] postinstall E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\pngquant-bin
node lib/install.js

√ pngquant pre-build test passed successfully
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1520 packages from 869 contributors and audited 21881 packages in 143.421s
found 30 vulnerabilities (2 low, 28 moderate)
run npm audit fix to fix them, or npm audit for details

Afroza@DESKTOP-4OHAIUI MINGW64 /e/xampp/htdocs/afroza/Final_Project/crm_ytm_new (master)
$ npm outdated
Package Current Wanted Latest Location
axios 0.15.3 0.15.3 0.18.0
cross-env 3.2.4 3.2.4 5.2.0
laravel-mix 0.12.1 0.12.1 2.1.11
yarn 0.16.1 0.16.1 1.7.0

Afroza@DESKTOP-4OHAIUI MINGW64 /e/xampp/htdocs/afroza/Final_Project/crm_ytm_new (master)
$ npm install
npm WARN [email protected] requires a peer of webpack@1 || 2 || ^2.1.0-beta || ^2.2.0-rc but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^1 || ^2 || ^3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^2.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^2.2.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

audited 21881 packages in 10.529s
found 30 vulnerabilities (2 low, 28 moderate)
run npm audit fix to fix them, or npm audit for details

Afroza@DESKTOP-4OHAIUI MINGW64 /e/xampp/htdocs/afroza/Final_Project/crm_ytm_new (master)
$ npm run dev

@ dev E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new
npm run development

@ development E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

10% building modules 0/1 modules 1 active …_ytm_new\resources\assets\sass\app.s 10% building modules 1/2 modules 1 active …\crm_ytm_new\resources\assets\js\app 10% building modules 1/3 modules 2 active …_ytm_new\resources\assets\sass\app.s 10% building modules 2/3 modules 1 active …\crm_ytm_new\resources\assets\js\app 10% building modules 2/4 modules 2 active …_ytm_new\resources\assets\sass\app.s 10% building modules 2/5 modules 3 active …\node_modules\style-loader\addStyles 10% building modules 3/5 modules 2 active …_ytm_new\resources\assets\sass\app.s 10% building modules 4/5 modules 1 active …_ytm_new\resources\assets\sass\app.s 10% building modules 4/6 modules 2 active …tm_new\resources\assets\js\bootstrap 10% building modules 4/7 modules 3 active …new\node_modules\vue\dist\vue.common 10% building modules 5/7 modules 2 active …tm_new\resources\assets\js\bootstrap.jsTypeError: dep.getResourceIdentifier is not a function
at addDependency (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:413:30)
at iterationOfArrayCallback (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:88:3)
at addDependenciesBlock (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:435:5)
at Compilation.processModuleDependencies (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:446:4)
at afterBuild (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:569:15)
at buildModule.err (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:613:11)
at callback (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:364:5)
at module.build.error (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:404:12)
at handleParseResult (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\NormalModule.js:458:12)
at doBuild.err (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\NormalModule.js:480:6)
at runLoaders (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\NormalModule.js:344:12)
at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\loader-runner\lib\LoaderRunner.js:370:3
at iterateNormalLoaders (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\loader-runner\lib\LoaderRunner.js:211:10)
at Array. (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\loader-runner\lib\LoaderRunner.js:202:4)
at Storage.finished (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:43:16)
at provider (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:79:9)
at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\graceful-fs\graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511: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! C:\Users\Afroza\AppData\Roaming\npm-cache_logs\2018-06-28T12_09_39_299Z-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! C:\Users\Afroza\AppData\Roaming\npm-cache_logs\2018-06-28T12_09_39_396Z-debug.log

Afroza@DESKTOP-4OHAIUI MINGW64 /e/xampp/htdocs/afroza/Final_Project/crm_ytm_new (master)
$ npm run watch

@ watch E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

10% building modules 0/1 modules 1 active …_ytm_new\resources\assets\sass\app.s 10% building modules 1/1 modules 0 active
webpack is watching the files…

10% building modules 1/2 modules 1 active …\crm_ytm_new\resources\assets\js\app 10% building modules 1/3 modules 2 active …_ytm_new\resources\assets\sass\app.s 10% building modules 2/3 modules 1 active …\crm_ytm_new\resources\assets\js\app 10% building modules 2/4 modules 2 active …_ytm_new\resources\assets\sass\app.s 10% building modules 2/5 modules 3 active …\node_modules\style-loader\addStyles 10% building modules 3/5 modules 2 active …_ytm_new\resources\assets\sass\app.s 10% building modules 4/5 modules 1 active …_ytm_new\resources\assets\sass\app.s 10% building modules 4/6 modules 2 active …tm_new\resources\assets\js\bootstrap 10% building modules 4/7 modules 3 active …new\node_modules\vue\dist\vue.common 10% building modules 5/7 modules 2 active …tm_new\resources\assets\js\bootstrap.jsTypeError: dep.getResourceIdentifier is not a function
at addDependency (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:413:30)
at iterationOfArrayCallback (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:88:3)
at addDependenciesBlock (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:435:5)
at Compilation.processModuleDependencies (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:446:4)
at afterBuild (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:569:15)
at buildModule.err (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:613:11)
at callback (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:364:5)
at module.build.error (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\Compilation.js:404:12)
at handleParseResult (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\NormalModule.js:458:12)
at doBuild.err (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\NormalModule.js:480:6)
at runLoaders (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\webpack\lib\NormalModule.js:344:12)
at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\loader-runner\lib\LoaderRunner.js:370:3
at iterateNormalLoaders (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\loader-runner\lib\LoaderRunner.js:211:10)
at Array. (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\loader-runner\lib\LoaderRunner.js:202:4)
at Storage.finished (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:43:16)
at provider (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:79:9)
at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\graceful-fs\graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch 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! C:\Users\Afroza\AppData\Roaming\npm-cache_logs\2018-06-28T12_10_28_535Z-debug.log

Afroza@DESKTOP-4OHAIUI MINGW64 /e/xampp/htdocs/afroza/Final_Project/crm_ytm_new (master)
$ yarn install
yarn install v1.7.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check.
Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/5] ⠐ waiting...
[-/5] ⠐ waiting...
[-/5] ⠐ waiting...
[-/5] ⠈ waiting...
error E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\node-sass: C
ommand failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\node-sa
ss
Output:
Building: E:\nodejs\node.exe E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\no
de_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_c
flags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'E:\nodejs\node.exe',
gyp verb cli 'E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modu
les\node-gyp\bin\node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which failed Error: not found: python2
gyp verb which failed at getNotFoundError (E:\xampp\htdocs\afroza\Final_Pr
oject\crm_ytm_new\node_moduleswhichwhich.js:13:12)
gyp verb which failed at F (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_n
ew\node_moduleswhichwhich.js:68:19)
gyp verb which failed at E (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_n
ew\node_moduleswhichwhich.js:80:29)
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_moduleswhichwhich.js:89:16
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_modules\isexe\index.js:42:5
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb which failed python2 { Error: not found: python2
gyp verb which failed at getNotFoundError (E:\xampp\htdocs\afroza\Final_Pr
oject\crm_ytm_new\node_moduleswhichwhich.js:13:12)
gyp verb which failed at F (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_n
ew\node_moduleswhichwhich.js:68:19)
gyp verb which failed at E (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_n
ew\node_moduleswhichwhich.js:80:29)
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_moduleswhichwhich.js:89:16
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_modules\isexe\index.js:42:5
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb which failed stack: 'Error: not found: python2\n at getNotFoundE
rror (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\which
\which.js:13:12)\n at F (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_n
ew\node_modules\which\which.js:68:19)\n at E (E:\xampp\htdocs\afroza\F
inal_Project\crm_ytm_new\node_modules\which\which.js:80:29)\n at E:\xamp
p\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\which\which.js:89:
16\n at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\
isexe\index.js:42:5\n at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_n
ew\node_modules\isexe\windows.js:36:5\n at FSReqWrap.oncomplete (fs.js:152
:21)',
gyp verb which failed code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb which failed Error: not found: python
gyp verb which failed at getNotFoundError (E:\xampp\htdocs\afroza\Final_Pr
oject\crm_ytm_new\node_moduleswhichwhich.js:13:12)
gyp verb which failed at F (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_n
ew\node_moduleswhichwhich.js:68:19)
gyp verb which failed at E (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_n
ew\node_moduleswhichwhich.js:80:29)
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_moduleswhichwhich.js:89:16
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_modules\isexe\index.js:42:5
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb which failed python { Error: not found: python
gyp verb which failed at getNotFoundError (E:\xampp\htdocs\afroza\Final_Pr
oject\crm_ytm_new\node_moduleswhichwhich.js:13:12)
gyp verb which failed at F (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_n
ew\node_moduleswhichwhich.js:68:19)
gyp verb which failed at E (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_n
ew\node_moduleswhichwhich.js:80:29)
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_moduleswhichwhich.js:89:16
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_modules\isexe\index.js:42:5
gyp verb which failed at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\
node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb which failed stack: 'Error: not found: python\n at getNotFoundEr
ror (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\which\
which.js:13:12)\n at F (E:\xampp\htdocs\afroza\Final_Project\crm_ytm_ne
w\node_modules\which\which.js:68:19)\n at E (E:\xampp\htdocs\afroza\Fi
nal_Project\crm_ytm_new\node_modules\which\which.js:80:29)\n at E:\xampp
\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\which\which.js:89:1
6\n at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\i
sexe\index.js:42:5\n at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_ne
w\node_modules\isexe\windows.js:36:5\n at FSReqWrap.oncomplete (fs.js:152:
21)',
gyp verb which failed code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at PythonFinder.failNoPython (E:\xampp\htdocs\afroza\Final_Pr
oject\crm_ytm_new\node_modules\node-gyp\lib\configure.js:492:19)
gyp ERR! stack at PythonFinder. (E:\xampp\htdocs\afroza\Final_Pro
ject\crm_ytm_new\node_modules\node-gyp\lib\configure.js:517:16)
gyp ERR! stack at E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modu
les\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "E:\nodejs\node.exe" "E:\xampp\htdocs\afroza\Final_Projec
t\crm_ytm_new\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose"
"--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd E:\xampp\htdocs\afroza\Final_Project\crm_ytm_new\node_modules\node-
sass
gyp ERR! node -v v8.11.2
gyp ERR! node-gyp -v v3.7.0

Work for me

  1. create a new laravel project
  2. edit the package.json
  3. install npm --save
  4. npm run dev
    thanks

show like this errors after I type npm run dev...
@DYsoftDev

@ dev /home/aung/design

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

module.js:549
throw err;
^

Error: Cannot find module 'nice-try'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/home/aung/design/node_modules/cross-spawn/lib/parse.js:4:17)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

npm ERR! Linux 4.15.0-29-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! @ 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
npm ERR! Exit status 1
npm ERR!
npm ERR! 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'.
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 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! 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
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/aung/design/npm-debug.log

This worked for me
npm install --global cross-env

@ramseyjiang I've been fighting this all morning. Out of about 30 attempts at different things... Yours was the only fix that worked. THANKS SO MUCH!

I had to disable Vagrant file sync and use plain SFTP. Then I cleared npm cache, reinstalled my npm packages and it all worked correctly as I remember.

For what it's worth, it was a lack of RAM on our server. Same exact general error. Adding some swap solved it. But it was hard to spot as the log didn't say anything and you usually have 1 terminal open that's locked out of other commands like "free -m" while it's compiling.

Frustrating that this is still happening with a fresh Laravel install. Created #2125

reinstall npm
$ npm install

when it is done rerun npm watch
$ npm run watch

following the steps of @nitin19srivastava and adding "bootstrap-sass": "^3.3.7" in package.json I got it

I tried everything on this thread but I get the following error

undefined:1625
    throw new JS_Parse_Error(message, filename, line, col, pos);
    ^
SyntaxError: Unexpected token: operator (>)
    at JS_Parse_Error.get (eval at <anonymous> (c:\xampp\htdocs\project_ski_new\node_modules\uglify-js\tools\node.js:27:1), <anonymous>:86:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=production 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.

This is the function registered on that file at that line

new Function("MOZ_SourceMap", "exports", FILES.map(function(file){
    return fs.readFileSync(file, "utf8");
}).join("\n\n"))(
    require("source-map"),
    UglifyJS
);

node -v 8.0.0
npm -v 5.0.0

EDIT: it works fine, but only in development. If I switch to production I get the error above mentioned

remove node_modules then install again ,it will be ok

@nitin19srivastava I fixed it that issue by myself way.

Step1: composer update
Step2: rm -rf node_modules
Step3: npm cache clean
Step4: npm install
Step5: npm outdated
In this step, I update my laravel-mix version to 1.2.0, it is in the package.json.
Step6: npm install
Step7: npm run dev
After all these steps, everything is good.

Thank you, it's work for me.

I had issues getting this to work on my Homestead and managed to get it working from my host machine (which runs macOS) with these steps:

  • Delete all files created on previous attempts:
    rm -rf node_modules
    rm package-lock.json
    rm yarn.lock
  • Install yarn on my host machine via homebrew: brew install yarn
  • Install the same version of node in my host machine than in Homestead: nvm install 12.16.2
  • From my host machine (outside the VM), run yarn install
  • Replace all appearances of npm with yarn in package.json
  • From my host machine, run: yarn run dev

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! C:\Users\user\AppData\Roamingnpm-cache_logs\2021-01-31T00_39_15_501Z-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! C:\Users\user\AppData\Roamingnpm-cache_logs\2021-01-31T00_39_15_555Z-debug.log

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dtheb picture dtheb  ·  3Comments

wendt88 picture wendt88  ·  3Comments

jpriceonline picture jpriceonline  ·  3Comments

kpilard picture kpilard  ·  3Comments

Cheddam picture Cheddam  ·  3Comments