Home > Blockchain >  NPM version is too old
NPM version is too old

Time:09-09

I'm running on a problem. My Laravel project is an old one, and I can't run npm run dev. Let's see some code:

php artisan laravel --version: Laravel Framework 5.8.38

node --version: v16.16.0 This is the actual version of Node installed

And the error when running NPM:

MacBook-Pro-de-Marcello:webroker marcellopato$ npm run dev
npm WARN npm npm does not support Node.js v16.16.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
npm WARN npm You can find the latest version at https://nodejs.org/

> @ dev /Users/marcellopato/Documents/Sites/webroker
> npm run development

npm WARN npm npm does not support Node.js v16.16.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
npm WARN npm You can find the latest version at https://nodejs.org/

> @ development /Users/marcellopato/Documents/Sites/webroker
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules/webpack/bin/webpack.js ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at one rrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at one rrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn node_modules/webpack/bin/webpack.js',
  path: 'node_modules/webpack/bin/webpack.js',
  spawnargs: [
    '--progress',
    '--hide-modules',
    '--config=node_modules/laravel-mix/setup/webpack.config.js'
  ]
}
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 WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/marcellopato/.npm/_logs/2022-08-29T14_40_33_577Z-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 WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/marcellopato/.npm/_logs/2022-08-29T14_40_33_659Z-debug.log

The 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 --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "axios": "^0.18.0",
        "bootstrap": "^4.1.3",
        "cross-env": "^5.2.0",
        "jquery": "^3.2",
        "laravel-mix": "^2.1.14",
        "lodash": "^4.17.11",
        "popper.js": "^1.14.3",
        "vue": "^2.5.16",
        "vuedraggable": "^2.16.0"
    },
    "dependencies": {
        "@tinymce/tinymce-vue": "^1.1.0",
        "@websanova/vue-upload": "^0.2.14-beta",
        "ajv": "^6.5.4",
        "jquery-filepond": "^1.0.0",
        "laravel-echo": "^1.4.0",
        "moment": "^2.22.2",
        "moment-timezone": "^0.5.21",
        "node-sass": "^4.9.4",
        "npm": "^6.4.1",
        "pusher-js": "^4.3.1",
        "tinymce-vue-2": "0.0.5",
        "v-calendar": "^0.9.7",
        "vlightbox": "^2.0.2",
        "vue-chat-scroll": "^1.2.0",
        "vue-google-charts": "^0.3.2",
        "vue-moment": "^4.0.0",
        "vue-scrollto": "^2.13.0",
        "vue-simple-lightbox": "^1.1.0",
        "vue-template-compiler": "^2.5.17",
        "vue-the-mask": "^0.11.1",
        "vue-toasted": "^1.1.25",
        "vue-upload-component": "^2.8.14",
        "vue-wysiwyg": "^1.7.2",
        "vue2-daterange-picker": "^0.1.1",
        "vue2-dropzone": "^3.5.2",
        "vue2-editor": "^2.6.1"
    }
}

I think the issue is relative to the actual version of Node, that is too new. Could be that? And if so, there's a way to know what version I had installed on my machine at the time I was working on the project for the first time?

Or the issue is a new one?

Now there's the log file:

0 verbose cli /Users/marcellopato/.nvm/versions/node/v16.17.0/bin/node /Users/marcellopato/.nvm/versions/node/v16.17.0/bin/npm
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/Users/marcellopato/.nvm/versions/node/v16.17.0/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 3ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/Users/marcellopato/Documents/Sites/webroker/.npmrc Completed in 0ms
10 timing config:load:project Completed in 19ms
11 timing config:load:file:/Users/marcellopato/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/Users/marcellopato/.nvm/versions/node/v16.17.0/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 2ms
18 timing config:load Completed in 33ms
19 timing npm:load:configload Completed in 33ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 1ms
22 verbose title npm install
23 verbose argv "install"
24 timing npm:load:setTitle Completed in 29ms
25 timing config:load:flatten Completed in 7ms
26 timing npm:load:display Completed in 11ms
27 verbose logfile logs-max:10 dir:/Users/marcellopato/.npm/_logs
28 verbose logfile /Users/marcellopato/.npm/_logs/2022-09-08T23_11_39_339Z-debug-0.log
29 timing npm:load:logFile Completed in 7ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 82ms
33 timing arborist:ctor Completed in 1ms
34 silly logfile start cleaning logs, removing 18 files
35 timing idealTree:init Completed in 1856ms
36 warn old lockfile
36 warn old lockfile The package-lock.json file was created with an old version of npm,
36 warn old lockfile so supplemental metadata must be fetched from the registry.
36 warn old lockfile so supplemental metadata must be fetched from the registry.
36 warn old lockfile
36 warn old lockfile This is a one-time fix-up, please be patient...
36 warn old lockfile
37 silly inflate node_modules/@tinymce/tinymce-vue
38 silly inflate node_modules/@types/node
39 silly inflate node_modules/@types/semver
40 silly inflate node_modules/@websanova/vue-upload
41 silly logfile done cleaning log files
42 http fetch GET 200 https://registry.npmjs.org/@types/semver 414ms (cache revalidated)
43 silly inflate node_modules/abbrev
44 http fetch GET 200 https://registry.npmjs.org/npm 2310ms (cache revalidated)
45 http fetch GET 200 https://registry.npmjs.org/abbrev 155ms (cache revalidated)
46 silly inflate node_modules/accepts
47 http fetch GET 200 https://registry.npmjs.org/@types/node 579ms (cache updated)
48 silly inflate node_modules/acorn
49 http fetch GET 200 https://registry.npmjs.org/accepts 84ms (cache revalidated)
50 silly inflate node_modules/acorn-dynamic-import
51 http fetch GET 200 https://registry.npmjs.org/acorn 73ms (cache revalidated)
52 silly inflate node_modules/acorn-dynamic-import/node_modules/acorn
53 silly inflate node_modules/adjust-sourcemap-loader
54 http fetch GET 200 https://registry.npmjs.org/adjust-sourcemap-loader 62ms (cache revalidated)
55 silly inflate node_modules/adjust-sourcemap-loader/node_modules/camelcase
56 http fetch GET 200 https://registry.npmjs.org/camelcase 82ms (cache revalidated)
57 silly inflate node_modules/adjust-sourcemap-loader/node_modules/lodash.defaults
58 http fetch GET 200 https://registry.npmjs.org/lodash.defaults 59ms (cache revalidated)
59 silly inflate node_modules/adjust-sourcemap-loader/node_modules/lodash.defaults/node_modules/lodash.assign
60 http fetch GET 200 https://registry.npmjs.org/lodash.assign 63ms (cache revalidated)
61 silly inflate node_modules/ajv
62 http fetch GET 200 https://registry.npmjs.org/acorn-dynamic-import 328ms (cache revalidated)
63 silly inflate node_modules/ajv-keywords
64 http fetch GET 200 https://registry.npmjs.org/ajv 54ms (cache revalidated)
65 silly inflate node_modules/align-text
66 http fetch GET 200 https://registry.npmjs.org/ajv-keywords 51ms (cache revalidated)
67 silly inflate node_modules/align-text/node_modules/kind-of
68 http fetch GET 200 https://registry.npmjs.org/kind-of 48ms (cache revalidated)
69 silly inflate node_modules/alphanum-sort
70 http fetch GET 200 https://registry.npmjs.org/alphanum-sort 66ms (cache revalidated)
71 silly inflate node_modules/amdefine
72 http fetch GET 200 https://registry.npmjs.org/@tinymce/tinymce-vue 1189ms (cache revalidated)
73 silly inflate node_modules/ansi-html
74 http fetch GET 200 https://registry.npmjs.org/@websanova/vue-upload 1200ms (cache revalidated)
75 silly inflate node_modules/ansi-regex
76 http fetch GET 200 https://registry.npmjs.org/amdefine 48ms (cache revalidated)
77 silly inflate node_modules/ansi-styles
78 http fetch GET 200 https://registry.npmjs.org/ansi-html 54ms (cache revalidated)
79 silly inflate node_modules/anymatch
80 http fetch GET 200 https://registry.npmjs.org/ansi-regex 50ms (cache revalidated)
81 silly inflate node_modules/aproba
82 http fetch GET 200 https://registry.npmjs.org/ansi-styles 62ms (cache revalidated)
83 silly inflate node_modules/are-we-there-yet
84 http fetch GET 200 https://registry.npmjs.org/align-text 274ms (cache revalidated)
85 silly inflate node_modules/argparse
86 http fetch GET 200 https://registry.npmjs.org/anymatch 55ms (cache revalidated)
87 silly inflate node_modules/arr-diff
88 http fetch GET 200 https://registry.npmjs.org/aproba 52ms (cache revalidated)
89 silly inflate node_modules/arr-flatten
90 http fetch GET 200 https://registry.npmjs.org/are-we-there-yet 79ms (cache revalidated)
91 silly inflate node_modules/arr-union
92 http fetch GET 200 https://registry.npmjs.org/argparse 70ms (cache revalidated)
93 silly inflate node_modules/array-find-index
94 http fetch GET 200 https://registry.npmjs.org/arr-diff 66ms (cache revalidated)
95 silly inflate node_modules/array-flatten
96 http fetch GET 200 https://registry.npmjs.org/arr-flatten 66ms (cache revalidated)
97 silly inflate node_modules/array-includes
98 http fetch GET 200 https://registry.npmjs.org/array-find-index 77ms (cache revalidated)
99 silly inflate node_modules/array-union
100 http fetch GET 200 https://registry.npmjs.org/array-flatten 73ms (cache revalidated)
101 silly inflate node_modules/array-uniq
102 http fetch GET 200 https://registry.npmjs.org/arr-union 102ms (cache revalidated)
103 silly inflate node_modules/array-unique
104 http fetch GET 200 https://registry.npmjs.org/array-includes 90ms (cache revalidated)
105 silly inflate node_modules/asn1
106 http fetch GET 200 https://registry.npmjs.org/array-union 108ms (cache revalidated)
107 silly inflate node_modules/asn1.js
108 http fetch GET 200 https://registry.npmjs.org/array-uniq 106ms (cache revalidated)
109 silly inflate node_modules/assert
110 http fetch GET 200 https://registry.npmjs.org/array-unique 93ms (cache revalidated)

CodePudding user response:

Probably your current npm is incompatible with the node version.

I advise you to reinstall npm and then install the node again.

  1. Delete npm Mac: sudo npm uninstall -g npm

    Windows: npm uninstall -g npm

  2. Install node.js https://nodejs.org

  • Related