marcel158's avatar

Always problems with npm run command >:(

Man, I hate it! Why do I always experience such problems with the "npm run dev" or "npm run production" command. Til today I never got it to work on my webspace or macbook. However it works on my iMac, I don't know how I managed this.

For some reason, I had to format my macbook's disk. I reinstalled the whole OS. Fresh start. Set up apache, mysql, phpmyadmin, git, composer, the latest versions of node and npm, ... Git cloned my repository.

composer install

That command alone didn't get npm run to work. Also after trying npm install and different variations, it did not.

Marcels-MacBook-Pro:Partyfinder marcel$ npm run dev

> @ dev /Users/marcel/Webspace/Partyfinder
> npm run development


> @ development /Users/marcel/Webspace/Partyfinder
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

 95% emitting                                                                      

 ERROR  Failed to compile with 2 errors                                     22:13:49

 error  in ./resources/assets/sass/app.scss

Module build failed: 
@import "node_modules/font-awesome/scss/font-awesome";
^
      File to import not found or unreadable: node_modules/font-awesome/scss/font-awesome.
Parent style sheet: stdin
      in /Users/marcel/Webspace/Partyfinder/resources/assets/sass/app.scss (line 12, column 1)

 @ ./resources/assets/sass/app.scss 4:14-266
 @ multi ./node_modules/laravel-mix/src/builder/mock-entry.js ./resources/assets/sass/app.scss

 error  in ./resources/assets/sass/app.scss

Module build failed: ModuleBuildError: Module build failed: 
@import "node_modules/font-awesome/scss/font-awesome";
^
      File to import not found or unreadable: node_modules/font-awesome/scss/font-awesome.
Parent style sheet: stdin
      in /Users/marcel/Webspace/Partyfinder/resources/assets/sass/app.scss (line 12, column 1)
    at runLoaders (/Users/marcel/Webspace/Partyfinder/node_modules/webpack/lib/NormalModule.js:195:19)
    at /Users/marcel/Webspace/Partyfinder/node_modules/loader-runner/lib/LoaderRunner.js:364:11
    at /Users/marcel/Webspace/Partyfinder/node_modules/loader-runner/lib/LoaderRunner.js:230:18
    at context.callback (/Users/marcel/Webspace/Partyfinder/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at Object.asyncSassJobQueue.push [as callback] (/Users/marcel/Webspace/Partyfinder/node_modules/sass-loader/lib/loader.js:55:13)
    at Object.<anonymous> (/Users/marcel/Webspace/Partyfinder/node_modules/async/dist/async.js:2244:31)
    at Object.callback (/Users/marcel/Webspace/Partyfinder/node_modules/async/dist/async.js:906:16)
    at options.error (/Users/marcel/Webspace/Partyfinder/node_modules/node-sass/lib/index.js:294:32)

     Asset     Size  Chunks             Chunk Names
    mix.js  4.06 kB       0  [emitted]  mix
/js/all.js   539 kB          [emitted]  
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/marcel/.npm/_logs/2017-09-19T20_13_49_744Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 2
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!     /Users/marcel/.npm/_logs/2017-09-19T20_13_49_783Z-debug.log
Marcels-MacBook-Pro:Partyfinder marcel$ cat /Users/marcel/.npm/_logs/2017-09-19T20_13_49_783Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle @~predev: @
6 info lifecycle @~dev: @
7 verbose lifecycle @~dev: unsafe-perm in lifecycle true
8 verbose lifecycle @~dev: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/marcel/Webspace/Partyfinder/node_modules/.bin:/usr/local/php5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle @~dev: CWD: /Users/marcel/Webspace/Partyfinder
10 silly lifecycle @~dev: Args: [ '-c', 'npm run development' ]
11 silly lifecycle @~dev: Returned: code: 2  signal: null
12 info lifecycle @~dev: Failed to exec dev script
13 verbose stack Error: @ dev: `npm run development`
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:106:13)
13 verbose stack     at EventEmitter.emit (events.js:191: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:106:13)
13 verbose stack     at ChildProcess.emit (events.js:191:7)
13 verbose stack     at maybeClose (internal/child_process.js:920:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
14 verbose pkgid @
15 verbose cwd /Users/marcel/Webspace/Partyfinder
16 verbose Darwin 16.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v6.11.3
19 verbose npm  v5.4.2
20 error code ELIFECYCLE
21 error errno 2
22 error @ dev: `npm run development`
22 error Exit status 2
23 error Failed at the @ dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

In one line it says "Module build failed: ModuleBuildError: Module build failed: @import "node_modules/font-awesome/scss/font-awesome";" and indeed, I cannot find a font-awesome folder in node modules. But why is that? It's using the same package.json as on my iMac, where the command works.

0 likes
2 replies
sutherland's avatar
Level 28

Is font-awesome in the package.json file? Try deleting the node_modules folder and running npm install again. If it's not in package.json run npm install font-awesome --save-dev

marcel158's avatar

Oh my god yessss! That alone didn't fixed it. After installing font-awesome there was another error with an incorrect image path. This will probably also fix it on my webspace ?. Dunno how it could work on my iMac.

Thx! Problem solved!

Please or to participate in this conversation.