1

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 [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: 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?

3 Answers 3

4

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.

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 -_-

Sign up to request clarification or add additional context in comments.

1 Comment

This was one of the main reasons I've switched to using vue cli 3 in all my Laravel projects.
0

Usually this error stems from Node not being compatible to the version of the Laravel your trying to run. Some scripts will not be executed due to missing packages and configurations, in this case there is no custom error hence the error

7 verbose lifecycle @~dev: unsafe-perm in lifecycle true
12 info lifecycle @~dev: Failed to exec dev script

which can be found in logs.

C:\Users\[username]\AppData\Roaming\npm-cache\_logs\log-file-nameZ-debug.log
  • Check the version of Laravel if 9 and below downgrade Node to aleast v17.x
  • Check the version of Laravel if 10 and above upgrade to a stable version v20.x

Delete node_modules folder and the package.json

Run npm install then npm run dev

Good luck!

Comments

-1
{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },
    "devDependencies": {
        "@tailwindcss/forms": "^0.4.0",
        "alpinejs": "^3.4.2",
        "autoprefixer": "^10.4.2",
        "axios": "^0.21",
        "bootstrap": "^4.6.0",
        "jquery": "^3.5",
        "laravel-mix": "^6.0.6",
        "laravel-mix-merge-manifest": "^2.1.0",
        "lodash": "^4.17.19",
        "popper.js": "^1.16",
        "postcss": "^8.4.6",
        "sass": "^1.32.1",
        "sass-loader": "^10.1.1",
        "tailwindcss": "^3.0.18"
    },
    "dependencies": {
        "codemirror": "^6.0.1"
    }
}

paste this in your package.json and then delete the package-lock.json , delete the node_modules folder and run npm install. then followed by npm run dev and thats all... its 100% worked for me.LARAVEL 8.x , 9.x ,6.x

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.