Yocto build failed with npm v8 - npm

Issue and Context
I'm currently migrating to Yocto Kirkstone and need some npm packages to be installed on the image.
I was using Dunfell previously which ships with npm v6, I could build it without issue.
But with Kirkstone (and npm v8) it fails during npm pack stating that a command could not be found.
Forcing NodeJs v14 with a custom recipe and defining PREFERRED_VERSION:nodejs work but I would like to stick to v16.
As an example, I will use the runmd package as the one I try to install has much more dependencies and I faced the same issue with runmd.
With this package the first command not found is husky.
What I tried
Generating a new .bb file with devtool add "npm://registry.npmjs.org;package=runmd;version=1.3.6"
=> same issue
Installing other packages
=> same issue
Running the command that fails with npm v6 from the host
=> it worked as before
Checked if the missing package is installed with npm list in the source directory (workspace/sources/runmd)
=> it wasn't
npm list | grep husky
β”œβ”€β”€ UNMET DEPENDENCY husky#8.0.1
npm ERR! code ELSPROBLEMS
npm ERR! missing: husky#8.0.1, required by runmd#1.3.6
...
Forced the installation of husky by running npm install --legacy-peer-deps and run the same command again
=> it went a bit further but then failed by not finding husky in tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/npm-package this time (see logs)
Tried to force the --legacy-peer-deps in npm.bbclass as EXTRA_OENPM cannot be overwritten and NPM_INSTALL_DEV did not helped (I know, it's bad 😬)
=> still facing the issue
What I suspect
Seems like it has something to do with the new way npm handles dependencies but I can't figure out what to do/try next to fix it.
I'm not an Yocto nor npm v8 expert, so I might have overseen something.
Logs
NOTE: Executing Tasks
NOTE: runmd: compiling from external source tree /yocto/project/nuc-build/workspace/sources/runmd
ERROR: runmd-1.3.6-r0 do_compile: Error executing a python function in exec_func_python() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:npm_do_compile(d)
0003:
File: '/yocto/project/sources/poky/meta/classes/npm.bbclass', lineno: 262, function: npm_do_compile
0258: args.append(("target_arch", d.getVar("NPM_ARCH")))
0259: args.append(("build-from-source", "true"))
0260:
0261: # Pack and install the main package
*** 0262: tarball = npm_pack(env, d.getVar("NPM_PACKAGE"), tmpdir)
0263: cmd = "npm install %s %s" % (shlex.quote(tarball), d.getVar("EXTRA_OENPM"))
0264: env.run(cmd, args=args)
0265:}
0266:
File: '/yocto/project/sources/poky/meta/classes/npm.bbclass', lineno: 67, function: npm_pack
0063: cmd = "npm pack %s" % shlex.quote(srcdir)
0064: args = [("ignore-scripts", "true")]
0065: print(cmd)
0066: print(args)
*** 0067: tarball = env.run(cmd, args=args, workdir=workdir).strip("\n")
0068: return os.path.join(workdir, tarball)
0069:
0070:python npm_do_configure() {
0071: """
File: '/yocto/project/sources/poky/bitbake/lib/bb/fetch2/npm.py', lineno: 126, function: run
0122: if args:
0123: for key, value in args:
0124: cmd += " --%s=%s" % (key, shlex.quote(value))
0125:
*** 0126: return _run(cmd)
0127:
0128:class Npm(FetchMethod):
0129: """Class to fetch a package from a npm registry"""
0130:
File: '/yocto/project/sources/poky/bitbake/lib/bb/fetch2/npm.py', lineno: 114, function: _run
0110:
0111: def _run(cmd):
0112: cmd = "NPM_CONFIG_USERCONFIG=%s " % (self.user_config.name) + cmd
0113: cmd = "NPM_CONFIG_GLOBALCONFIG=%s " % (self.global_config_name) + cmd
*** 0114: return runfetchcmd(cmd, d, workdir=workdir)
0115:
0116: if configs:
0117: bb.warn("Use of configs argument of NpmEnvironment.run() function"
0118: " is deprecated. Please use args argument instead.")
File: '/yocto/project/sources/poky/bitbake/lib/bb/fetch2/__init__.py', lineno: 929, function: runfetchcmd
0925: bb.utils.remove(f, True)
0926: except OSError:
0927: pass
0928:
*** 0929: raise FetchError(error_message)
0930:
0931: return output
0932:
0933:def check_network_access(d, info, url):
Exception: bb.fetch2.FetchError: Fetcher failure: Fetch command export PSEUDO_DISABLED=1; export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"; export PATH="/yocto/project/nuc-build/tmp/sysroots-uninative/x86_64-linux/usr/bin:/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/usr/bin/python3-native:/yocto/project/sources/poky/scripts:/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux:/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot/usr/bin/crossscripts:/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/usr/sbin:/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/usr/bin:/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/sbin:/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/bin:/yocto/project/sources/poky/bitbake/bin:/yocto/project/nuc-build/tmp/hosttools"; export HOME="/tmp/tmp8wc17ixl"; NPM_CONFIG_GLOBALCONFIG=/dev/null NPM_CONFIG_USERCONFIG=/tmp/tmpjceiejg8 npm pack /yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/npm-package --ignore-scripts=true failed with exit code 127, output:
npm verb cli [
npm verb cli '/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/usr/bin/node',
npm verb cli '/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/usr/bin/npm',
npm verb cli 'pack',
npm verb cli '/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/npm-package',
npm verb cli '--ignore-scripts=true'
npm verb cli ]
npm info using npm#8.5.0
npm info using node#v16.14.2
npm timing npm:load:whichnode Completed in 1ms
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/usr/lib/node_modules/npm/npmrc Completed in 1ms
npm timing config:load:builtin Completed in 1ms
npm timing config:load:cli Completed in 1ms
npm timing config:load:env Completed in 0ms
npm timing config:load:file:/tmp/tmpkm1z714f/.npmrc Completed in 0ms
npm timing config:load:project Completed in 1ms
npm verb config only Use `--omit=dev` to omit dev dependencies from the install.
npm timing config:load:file:/tmp/tmpjceiejg8 Completed in 2ms
npm timing config:load:user Completed in 2ms
npm timing config:load:file:/dev/null Completed in 1ms
npm timing config:load:global Completed in 1ms
npm timing config:load:validate Completed in 1ms
npm timing config:load:credentials Completed in 1ms
npm timing config:load:setEnvs Completed in 0ms
npm timing config:load Completed in 10ms
npm timing npm:load:configload Completed in 10ms
npm timing npm:load:setTitle Completed in 1ms
npm timing config:load:flatten Completed in 2ms
npm timing npm:load:display Completed in 4ms
npm verb logfile /yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/npm-cache/_logs/2022-06-20T09_50_23_086Z-debug-0.log
npm timing npm:load:logFile Completed in 3ms
npm timing npm:load:timers Completed in 0ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load Completed in 19ms
npm timing command:pack Completed in 16ms
npm verb stack Error: command failed
npm verb stack at ChildProcess.<anonymous> (/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/usr/lib/node_modules/npm/node_modules/#npmcli/promise-spawn/index.js:64:27)
npm verb stack at ChildProcess.emit (node:events:526:28)
npm verb stack at maybeClose (node:internal/child_process:1092:16)
npm verb stack at Socket.<anonymous> (node:internal/child_process:451:11)
npm verb stack at Socket.emit (node:events:526:28)
npm verb stack at Pipe.<anonymous> (node:net:687:12)
npm verb pkgid runmd#1.3.6
npm verb cwd /tmp/tmpkm1z714f
npm verb Linux 5.13.0-1029-azure
npm verb argv "/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/usr/bin/node" "/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/recipe-sysroot-native/usr/bin/npm" "pack" "/yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/npm-package" "--ignore-scripts=true"
npm verb node v16.14.2
npm verb npm v8.5.0
npm ERR! code 127
npm ERR! path /yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/npm-package
npm ERR! command failed
npm ERR! command sh -c husky install
npm ERR! sh: 1: husky: not found
npm verb exit 127
npm timing npm Completed in 132ms
npm verb code 127
npm ERR! A complete log of this run can be found in:
npm ERR! /yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/npm-cache/_logs/2022-06-20T09_50_23_086Z-debug-0.log
ERROR: Logfile of failure stored in: /yocto/project/nuc-build/tmp/work/corei7-64-poky-linux/runmd/1.3.6-r0/temp/log.do_compile.37326
ERROR: Task (/yocto/project/nuc-build/workspace/recipes/runmd/runmd_1.3.6.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1074 tasks of which 1067 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/yocto/project/nuc-build/workspace/recipes/runmd/runmd_1.3.6.bb:do_compile
Summary: There was 1 ERROR message, returning a non-zero exit code.
(The complete log referenced doesn't really help neither)
Thanks a lot in advance !

npm with kirkstone is broken; you can try patches from https://patchwork.yoctoproject.org/project/oe-core/list/?series=4303

Related

Vue-cli : ERROR Error: command failed: npm install --loglevel error --legacy-peer-deps

When I try to create a new project (vue create my-project), I get this error:
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\npm-cache\_logs\2023-01-14T16_48_04_209Z-debug-0.log
**ERROR** Error: command failed: npm install --loglevel error --legacy-peer-deps
Error: command failed: npm install --loglevel error --legacy-peer-deps
at ChildProcess.<anonymous> (C:\Users\hp\AppData\Roaming\npm\node_modules\#vue\cli\lib\util\executeCommand.js:138:16)
at ChildProcess.emit (node:events:513:28)
at cp.emit (C:\Users\hp\AppData\Roaming\npm\node_modules\#vue\cli\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1098:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5)
I'm on PC / Windows 10, and updated vue/cli, node, and npm.
Persets: ([Vue 3] dart-sass, babel, router, vuex, unit-jest).
I updated vue/cli, node, npm, and yarn.
I search for a solution here, and tried these solutions:
npm cache clean --force
npm config set registry="http://registry.npmjs.org/"
vue config --set useTaobaoRegistry false
npm config set fetch-retry-mintimeout 20000 (This did't work).
npm config set fetch-retry-maxtimeout 120000 (This did't work).
But the error is still when creating a project.
After the Internet acceleration procedures, the packages were downloaded, but this error remained:
npm ERR! Invalid Version:
npm ERR! A complete log of this run can be found in:
npm ERR! C:\npm-cache_logs\2023-01-16T19_19_07_037Z-debug-0.log
ERROR Error: command failed: npm install --loglevel error --legacy-peer-deps
Error: command failed: npm install --loglevel error --legacy-peer-deps
at ChildProcess. (C:\Users\hp\AppData\Roaming\npm\node_modules#vue\cli\lib\util\executeCommand.js:138:16)
at ChildProcess.emit (node:events:513:28)
at cp.emit (C:\Users\hp\AppData\Roaming\npm\node_modules#vue\cli\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1098:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5)

How to properly run npm install scripts?

I'm trying to execute a Node.js script after my package is installed. But even testing with a simple echo command fails already.
Because I'm testing with local installation first, I've also tried the prepare script instead of install, but get the same results: no execution.
Suppose I have Package A (PA) that I want to install into Package B (PB).
PA's package.json script part looks like the following (tried install and prepare):
"install": "echo INSTALLED"
Installing it in PB like so:
npm install --save-dev ../package-a
But the echo, that should show something in console, seems to do nothing.
What do I oversee?
Update 1
Here's the verbose output of npm-install:
$ npm install --save-dev --loglevel verbose ../package-a/
npm verb cli [
npm verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm verb cli 'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli 'install',
npm verb cli '--save-dev',
npm verb cli '--loglevel',
npm verb cli 'verbose',
npm verb cli '../package-a/'
npm verb cli ]
npm info using npm#8.5.5
npm info using node#v16.14.2
npm timing npm:load:whichnode Completed in 0ms
npm timing config:load:defaults Completed in 5ms
npm timing config:load:file:C:\Users\User\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 2ms
npm timing config:load:builtin Completed in 2ms
npm timing config:load:cli Completed in 2ms
npm timing config:load:env Completed in 1ms
npm timing config:load:file:F:\public\npm\package-b\.npmrc Completed in 0ms
npm timing config:load:project Completed in 2ms
npm timing config:load:file:C:\Users\User\.npmrc Completed in 1ms
npm timing config:load:user Completed in 1ms
npm timing config:load:file:C:\Users\User\AppData\Roaming\npm\etc\npmrc Completed in 1ms
npm timing config:load:global Completed in 1ms
npm timing config:load:validate Completed in 0ms
npm timing config:load:credentials Completed in 1ms
npm timing config:load:setEnvs Completed in 0ms
npm timing config:load Completed in 16ms
npm timing npm:load:configload Completed in 16ms
npm timing npm:load:setTitle Completed in 0ms
npm timing config:load:flatten Completed in 3ms
npm timing npm:load:display Completed in 7ms
npm verb logfile C:\Users\User\AppData\Local\npm-cache\_logs\2022-05-02T13_10_48_164Z-debug-0.log
npm timing npm:load:logFile Completed in 17ms
npm timing npm:load:timers Completed in 1ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load Completed in 42ms
npm timing arborist:ctor Completed in 1ms
npm timing idealTree:init Completed in 237ms
npm timing idealTree:userRequests Completed in 26ms
npm verb shrinkwrap failed to load node_modules/.package-lock.json missing from node_modules: ../package-c
npm timing idealTree:#root Completed in 16ms
npm timing idealTree:node_modules/package-a Completed in 0ms
npm timing idealTree:buildDeps Completed in 18ms
npm timing idealTree:fixDepFlags Completed in 3ms
npm timing idealTree Completed in 292ms
npm timing reify:loadTrees Completed in 560ms
npm timing reify:diffTrees Completed in 13ms
npm timing reify:retireShallow Completed in 0ms
npm timing reify:createSparse Completed in 3ms
npm timing reify:loadBundles Completed in 0ms
npm verb reify failed optional dependency F:\public\npm\package-b\node_modules\fsevents
npm timing reifyNode:node_modules/fsevents Completed in 21ms
npm timing reifyNode:node_modules/package-a Completed in 24ms
npm timing reify:unpack Completed in 24ms
npm timing reify:unretire Completed in 0ms
npm timing build:queue Completed in 0ms
npm timing build:deps Completed in 2ms
npm timing build:queue Completed in 1ms
npm timing build:links Completed in 1ms
npm timing build Completed in 4ms
npm timing reify:build Completed in 5ms
npm timing reify:trash Completed in 1ms
npm timing reify:save Completed in 64ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 422ms
npm timing auditReport:getReport Completed in 429ms
npm timing auditReport:init Completed in 0ms
npm timing reify:audit Completed in 430ms
npm timing reify Completed in 1015ms
added 1 package, and audited 480 packages in 1s
58 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
npm timing command:install Completed in 1022ms
npm verb exit 0
npm timing npm Completed in 1383ms
npm info ok
Update 2
I've noticed I can run npm install . inside PA and my NPM script is executed. So the question here is: How do I get scripts executed if package is installed by another one?
Try naming your script postinstall, so the script runs automatically after issuing npm install:
"scripts": {
...
"postinstall": "echo INSTALLED"
}
Ok, I still don't understand why, but my solution to get it up and running is:
If using a local path:
Use prepare instead of install or postinstall
prepare seems to only execute if there is also an install script available in package.json.
install may not be empty. So an echo or such is at least required.
If using local *.tgz package use install instead (maybe just run prepare)
As said, I still don't know why it is working like that, because I always understood that behaviour a bit more different than it seems to be.
So further explanation of someone who knows why it only works like that is highly appreciated.

Socket timeout when trying to create a new vue project with vue-cli

I'm getting an error when I create a new Vue project using vue-cli. Each time the create fails on a "Socket timeout" but a different request? I updated node using nvm and installed the latest vue-cli.
Terminal shows this:
Vue CLI v4.5.9
✨ Creating project in /Users/me/Documents/GitHub/myproject.
πŸ—ƒ Initializing git repository...
βš™οΈ Installing CLI plugins. This might take a while...
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! request to https://registry.npm.taobao.org/cosmiconfig failed, reason: Socket timeout
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/me/.npm/_logs/2020-12-07T11_02_37_391Z-debug.log
ERROR command failed: npm install --loglevel error --legacy-peer-deps
The create tends to fail around the log file is around line 4900. These are the last lines in the log file:
4875 timing idealTree:node_modules/webpack-dev-server/node_modules/anymatch/node_modules/normalize-path Completed in 0ms
4876 timing idealTree:buildDeps Completed in 164233ms
4877 timing idealTree:fixDepFlags Completed in 10ms
4878 timing idealTree Completed in 164265ms
4879 timing command:install Completed in 164269ms
4880 verbose type system
4881 verbose stack FetchError: request to https://registry.npm.taobao.org/cosmiconfig failed, reason: Socket timeout
4881 verbose stack at ClientRequest.<anonymous> (/Users/me/.nvm/versions/node/v15.3.0/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:97:14)
4881 verbose stack at ClientRequest.emit (node:events:376:20)
4881 verbose stack at TLSSocket.socketErrorListener (node:_http_client:490:9)
4881 verbose stack at TLSSocket.emit (node:events:388:22)
4881 verbose stack at emitErrorNT (node:internal/streams/destroy:188:8)
4881 verbose stack at emitErrorCloseNT (node:internal/streams/destroy:153:3)
4881 verbose stack at processTicksAndRejections (node:internal/process/task_queues:80:21)
4882 verbose cwd /Users/me/Documents/GitHub/myproject
4883 verbose Darwin 19.6.0
4884 verbose argv "/Users/me/.nvm/versions/node/v15.3.0/bin/node" "/Users/me/.nvm/versions/node/v15.3.0/bin/npm" "install" "--loglevel" "error" "--legacy-peer-deps"
4885 verbose node v15.3.0
4886 verbose npm v7.0.14
4887 error code ERR_SOCKET_TIMEOUT
4888 error errno ERR_SOCKET_TIMEOUT
4889 error request to https://registry.npm.taobao.org/cosmiconfig failed, reason: Socket timeout
4890 verbose exit 1
I ran into this as well. Fixed it by first running
vue config -e
Then setting this property to false:
{
"useTaobaoRegistry": false
}
Ok, I just updated my os to Big Sur and now it seems to work.
Updating to Big Sur did not help me.
This, however, helped:
sudo npm uninstall -g vue
sudo npm uninstall -g vue-cli
sudo npm uninstall -g #vue/cli
sudo npm cache clean --force
sudo npm install -g vue
sudo npm install -g #vue/cli

NPM install hangs on stage:loadCurrentTree

I have a package on npm that links to git+ssh://git#bitbucket.org/own-repository/coreee.git#release-2.0
It hangs very often. Occasionally it will install fast, but more often i must wait like idk, 15 minutes before it started. It was stuck on this line:
βΈ¨β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘βΈ© β § rollbackFailedOptional: verb npm-session 353d0cde074aa46d
npm config list give me this:
; cli configs
metrics-registry = "http://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.9.0 node/v10.15.0 darwin x64"
; userconfig /Users/me/.npmrc
registry = "http://registry.npmjs.org/"
; node bin location = /Users/me/.nvm/versions/node/v10.15.0/bin/node
; cwd = /Users/me/Sites/own/website
; HOME = /Users/me
Log of my last npm install:
npm i coreee --verbose
npm info it worked if it ends with ok
npm verb cli [ '/Users/me/.nvm/versions/node/v10.15.0/bin/node',
npm verb cli '/Users/me/.nvm/versions/node/v10.15.0/bin/npm',
npm verb cli 'i',
npm verb cli 'coreee',
npm verb cli '--verbose' ]
npm info using npm#6.9.0
npm info using node#v10.15.0
npm verb npm-session f99560e8a75bc1cb
npm info lifecycle coreee#2.0.0~prepack: coreee#2.0.0
npm info lifecycle coreee#2.0.0~postpack: coreee#2.0.0
npm timing stage:loadCurrentTree Completed in **656301ms** <--- WTF!
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 25ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 1529ms
npm http fetch GET 304 http://registry.npmjs.org/immutable 149ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/jss 163ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/hammerjs 181ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/axios 191ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/fbemitter 202ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/calendar-js 202ms (from cache)
npm http fetch GET 304 http://registry.npmjs.org/jss-camel-case 202ms (from cache)
...
...
npm http fetch GET 304 http://registry.npmjs.org/deep-diff 114ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 11518ms
npm timing stage:loadIdealTree Completed in 13695ms
npm timing stage:generateActionsToTake Completed in 131ms
npm verb correctMkdir /Users/me/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /Users/me/.npm/_locks/staging-63f53d125cff0e0c.lock for /Users/me/Sites/own/website/node_modules/.staging
npm timing audit submit Completed in 753ms
npm http fetch POST 200 http://registry.npmjs.org/-/npm/v1/security/audits/quick 753ms
npm timing audit body Completed in 2ms
npm timing action:extract Completed in 6750ms
npm info lifecycle coreee#2.0.0~preuninstall: coreee#2.0.0
npm info lifecycle coreee#2.0.0~uninstall: coreee#2.0.0
npm verb unbuild rmStuff coreee#2.0.0 from /Users/me/Sites/own/website/node_modules
npm info lifecycle coreee#2.0.0~postuninstall: coreee#2.0.0
npm timing action:unbuild Completed in 1ms
npm timing action:remove Completed in 144ms
npm timing action:finalize Completed in 4ms
npm timing action:refresh-package-json Completed in 6ms
npm info lifecycle coreee#2.0.0~preinstall: coreee#2.0.0
npm timing action:preinstall Completed in 0ms
npm info linkStuff coreee#2.0.0
npm timing action:build Completed in 1ms
npm info lifecycle coreee#2.0.0~install: coreee#2.0.0
npm timing action:install Completed in 1ms
npm info lifecycle coreee#2.0.0~postinstall: coreee#2.0.0
npm timing action:postinstall Completed in 0ms
npm verb unlock done using /Users/me/.npm/_locks/staging-63f53d125cff0e0c.lock for /Users/me/Sites/own/website/node_modules/.staging
npm timing stage:executeActions Completed in 6926ms
npm timing stage:rollbackFailedOptional Completed in 1ms
npm timing stage:runTopLevelLifecycles Completed in 677567ms
npm verb saving [ { name: 'coreee',
npm verb saving spec:
npm verb saving 'git+ssh://git#bitbucket.org/own/coreee.git#release-2.0',
npm verb saving save: 'dependencies' } ]
npm verb shrinkwrap skipping write for package.json because there were no changes.
npm info lifecycle undefined~preshrinkwrap: undefined
npm info lifecycle undefined~shrinkwrap: undefined
npm info lifecycle undefined~postshrinkwrap: undefined
npm WARN react-native-gesture-handler#1.3.0 requires a peer of react-native#>= 0.58.2 but none is installed. You must install peer dependencies yourself.
npm WARN react-apollo#2.5.6 requires a peer of apollo-client#beta but none is installed. You must install peer dependencies yourself.
+ coreee#2.0.0
updated 1 package and audited 37620 packages in **678.671s** <--- WTF!
found 30 vulnerabilities (7 low, 5 moderate, 18 high)
run `npm audit fix` to fix them, or `npm audit` for details
npm verb exit [ 0, true ]
npm timing npm Completed in 679103ms
npm info ok
I have done npm cache clean --force to no result.
I have deleted my package-lock.json to no result.
What could i possibly missed? Can anyone please help me?

Npm install : FetchError: request to http://registry.npmjs.org/... failed, reason: read ECONNRESET

Trying to install any node package using npm hangs for about 5 mins then gives a ECONNRESET network error. I have been using npm for other projects recently and it worked fine but now will not work for any project(Including clean npm init)
npm i ws
This is on a Raspberry pi 3 running on my home network with no proxy requirements. All other machines both linux and windows are working fine.
npm -v = 6.4.1
I have tried the following:
npm i ws This gives me the ECONNRESET error (See below)
Curl https://registry.npmjs.org/
& Curl https://registry.npmjs.org/ws
Both return the correct json response
Removing any proxy settings
npm config rm proxy
npm config rm https-proxy
npm config set registry http://registry.npmjs.org/
Restarting etc
Full Error log:
npm i ws --save --verbose
npm info it worked if it ends with ok
npm verb cli [ '/home/pi/.nvm/versions/node/v8.16.0/bin/node',
npm verb cli '/home/pi/.nvm/versions/node/v8.16.0/bin/npm',
npm verb cli 'i',
npm verb cli 'ws',
npm verb cli '--save',
npm verb cli '--verbose' ]
npm info using npm#6.4.1
npm info using node#v8.16.0
npm verb npm-session 0a9bedb5def7f4a1
npm timing stage:rollbackFailedOptional Completed in 6ms
npm timing stage:runTopLevelLifecycles Completed in 1146975ms
npm verb type system
npm verb stack FetchError: request to http://registry.npmjs.org/ws failed, reason: read ECONNRESET
npm verb stack at ClientRequest.req.on.err (/home/pi/.nvm/versions/node/v8.16.0/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
npm verb stack at emitOne (events.js:116:13)
npm verb stack at ClientRequest.emit (events.js:211:7)
npm verb stack at Socket.socketErrorListener (_http_client.js:401:9)
npm verb stack at emitOne (events.js:116:13)
npm verb stack at Socket.emit (events.js:211:7)
npm verb stack at emitErrorNT (internal/streams/destroy.js:66:8)
npm verb stack at _combinedTickCallback (internal/process/next_tick.js:139:11)
npm verb stack at process._tickCallback (internal/process/next_tick.js:181:9)
npm verb cwd /home/pi/projects/picamera/node_server
npm verb Linux 4.19.37-v7+
npm verb argv "/home/pi/.nvm/versions/node/v8.16.0/bin/node" "/home/pi/.nvm/versions/node/v8.16.0/bin/npm" "i" "ws" "--save" "--verbose"
npm verb node v8.16.0
npm verb npm v6.4.1
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to http://registry.npmjs.org/ws failed, reason: read ECONNRESET
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm verb exit [ 1, true ]
npm timing npm Completed in 1148813ms
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2019-05-10T23_28_17_769Z-debug.log
First check following thing:
ping registry.npmjs.org
You will get to know the IP address from that like below:
PING registry.npmjs.org (104.16.20.35) 56(84) bytes of data.
Then
sudo vi /etc/hosts
104.16.20.35 registry.npmjs.org
Then try to do following
npm install