laravel npm run dev ERR! code ELIFECYCLE Failed at the @ development script

萝らか妹 提交于 2019-12-25 02:46:11

问题


i'm trying to run npm run dev but it failed

node ver: 11.2.0, npm ver: 6.4.1, os:windows10

it gives out this error:


> @ dev C:\xampp\htdocs\laravel\tutorial
> npm run development


> @ development C:\xampp\htdocs\laravel\tutorial
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

 70% building 12/18 modules 6 active ...utorial\node_modules\axios\lib\axios.jsTypeError: dep.getResourceIdentifier is not a function
    at addDependency (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\lib\Compilation.js:690:30)
    at iterationOfArrayCallback (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\lib\Compilation.js:194:3)
    at addDependenciesBlock (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\lib\Compilation.js:712:5)
    at Compilation.processModuleDependencies (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\lib\Compilation.js:723:4)
    at afterBuild (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\lib\Compilation.js:855:15)
    at buildModule.err (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\lib\Compilation.js:899:11)
    at callback (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\lib\Compilation.js:628:5)
    at module.build.error (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\lib\Compilation.js:676:12)
    at handleParseResult (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\lib\NormalModule.js:441:12)
    at doBuild.err (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\lib\NormalModule.js:463:6)
    at runLoaders (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\lib\NormalModule.js:327:12)
    at C:\xampp\htdocs\laravel\tutorial\node_modules\loader-runner\lib\LoaderRunner.js:370:3
    at iterateNormalLoaders (C:\xampp\htdocs\laravel\tutorial\node_modules\loader-runner\lib\LoaderRunner.js:211:10)
    at Array. (C:\xampp\htdocs\laravel\tutorial\node_modules\loader-runner\lib\LoaderRunner.js:202:4)
    at Storage.finished (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:43:16)
    at provider (C:\xampp\htdocs\laravel\tutorial\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:79:9)
    at C:\xampp\htdocs\laravel\tutorial\node_modules\graceful-fs\graceful-fs.js:90:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53: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\User\AppData\Roaming\npm-cache\_logs\2018-11-24T04_26_39_857Z-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.

and this is the log:


0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'dev' ]
2 info using npm@6.4.1
3 info using node@v11.2.0
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: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\xampp\htdocs\laravel\tutorial\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\User\bin;C:\oraclexe\app\oracle\product\11.2.0\server\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\android-sdk\platform-tools;C:\Gradle\gradle-4.7\bin;C:\WINDOWS\System32\OpenSSH;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\nodejs;C:\Users\User\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\User\AppData\Roaming\Composer\vendor\bin;C:\Users\User\AppData\Roaming\npm
9 verbose lifecycle @~dev: CWD: C:\xampp\htdocs\laravel\tutorial
10 silly lifecycle @~dev: Args: [ '/d /s /c', 'npm run development' ]
11 silly lifecycle @~dev: Returned: code: 1  signal: null
12 info lifecycle @~dev: Failed to exec dev script
13 verbose stack Error: @ dev: `npm run development`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:978:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
14 verbose pkgid @
15 verbose cwd C:\xampp\htdocs\laravel\tutorial
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v11.2.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error @ dev: `npm run development`
22 error Exit status 1
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 [ 1, true ]

i've search and tried various ways from various websites including here such as:

solution 1)

  • delete node_module folder or by $rm -rf node_modules
  • delete package-lock.json
  • npm clear cache --force
  • npm install

solution 2)

  • npm install -g cross-env

solution 3)

  • npm cache verify

solution 4)

  • npm install webpack@latest

solution 5)

  • replace cross-env with 'node' or 'set' in package.json
  • or putting the dist before /bin in package.json

solution 6)

  • npm update

i'm out of option and solution. is there another way to solve this?

p/s: i read something about the ram of server ran out or something like that. does it have anything to do with my error?


回答1:


this is a workaround, not an actual fix. the solution was to change the webpack version. i had the latest version of 4.26.0. apparently, mix doesn't work well with v4.

  • npm i webpack@3.1.0

i got the solution from here: When running npm run dev getting this error dep.getResourceIdentifier is not a function #1610

can't believe i spend >10 hours trying to fix this only to find myself the answer minutes after i post it online -_-



来源:https://stackoverflow.com/questions/53455293/laravel-npm-run-dev-err-code-elifecycle-failed-at-the-development-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!