NPM install hangs on stage:loadCurrentTree - npm

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?

Related

Yocto build failed with npm v8

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

Error Installing Gatsby Starter 'Something went wrong installing the "sharp" module'

Problem
I am trying to set up a Gatsby starter project on Windows. Specifically, this starter project: https://www.gatsbyjs.com/starters/hasura/gatsby-gitbook-starter/
Versions:
Node: v14.10.1
npm: 6.14.8
Gatsby CLI version: 2.12.99
Gatsby version: 2.18.10
Initial Steps that created error:
I opened a new terminal and ran the Gatsby Starter script according to the documentation:
"gatsby new gatsby-gitbook-starter https://github.com/hasura/gatsby-gitbook-starter"
After the initial starter is cloned successfully I am instructed to cd into the directory and run "gatsby-develop".
This throws the following error:
success open and validate gatsby-configs - 0.081s
ERROR
Something went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp.node'
Require stack:
- C:\code\Sutro\gatsby-gitbook-starter2\node_modules\sharp\lib\constructor.js
- C:\code\Sutro\gatsby-gitbook-starter2\node_modules\sharp\lib\index.js
- C:\code\Sutro\gatsby-gitbook-starter2\node_modules\gatsby-plugin-sharp\safe-sharp.js
- C:\code\Sutro\gatsby-gitbook-starter2\node_modules\gatsby-plugin-sharp\index.js
- C:\code\Sutro\gatsby-gitbook-starter2\node_modules\gatsby-plugin-sharp\gatsby-node.js
- C:\code\Sutro\gatsby-gitbook-starter2\node_modules\gatsby\dist\bootstrap\resolve-module-exports.js
- C:\code\Sutro\gatsby-gitbook-starter2\node_modules\gatsby\dist\bootstrap\load-plugins\validate.js
- C:\code\Sutro\gatsby-gitbook-starter2\node_modules\gatsby\dist\bootstrap\load-plugins\load.js
- C:\code\Sutro\gatsby-gitbook-starter2\node_modules\gatsby\dist\bootstrap\load-plugins\index.js
- C:\code\Sutro\gatsby-gitbook-starter2\node_modules\gatsby\dist\bootstrap\index.js
- C:\code\Sutro\gatsby-gitbook-starter2\node_modules\gatsby\dist\commands\develop.js
- C:\Users\mxgel\AppData\Roaming\npm\node_modules\gatsby-cli\lib\create-cli.js
- C:\Users\mxgel\AppData\Roaming\npm\node_modules\gatsby-cli\lib\index.js
- C:\Users\mxgel\AppData\Roaming\npm\node_modules\gatsby-cli\cli.js
- Remove the "node_modules/sharp" directory, run "npm install" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/
- Search for this error at https://github.com/lovell/sharp/issues
⠋ load plugins
My hunch is that this error is being thrown because of some global package manager configuration that I can't figure out, not the Sharp dependency itself. My goal is to use this Gatsby starter to streamline the process of project documentation.
Describe what you’ve tried
Followed Error Recommendations
My first step was to try the recommendation thrown by the error itself.
I tried removing the node_modules/sharp directory and running npm install but it gave me no errors and did not fix the problem. Its output from the NPM install was as follows.
added 2 packages from 60 contributors and audited 2713 packages in 12.906s
54 packages are looking for funding
run `npm fund` for details
found 1219 vulnerabilities (1168 low, 2 moderate, 49 high)
run `npm audit fix` to fix them, or `npm audit` for details
Removed Sharp Module, Reinstalled with Verbose Flag
Assuming that the 'verbose' flag would help, I removed the module and package-lock.json and ran npm install sharp --verbose:
npm info it worked if it ends with ok
npm verb cli [
npm verb cli 'C:\\nodejs\\node.exe',
npm verb cli 'C:\\Users\\mxgel\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli 'install',
npm verb cli 'sharp',
npm verb cli '--verbose'
npm verb cli ]
npm info using npm#6.14.8
npm info using node#v14.10.1
npm verb npm-session 166ad6819380c39e
npm http fetch GET 304 https://registry.npmjs.org/sharp 240ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/sharp/-/sharp-0.26.1.tgz 103ms (from cache)
npm timing stage:loadCurrentTree Completed in 3562ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 44ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 938ms
npm http fetch GET 304 https://registry.npmjs.org/semver 85ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/fsevents 114ms (from cache)
npm WARN deprecated fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm http fetch GET 304 https://registry.npmjs.org/bindings 145ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/file-uri-to-path 101ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 8627ms
npm timing stage:loadIdealTree Completed in 10371ms
npm timing stage:generateActionsToTake Completed in 190ms
npm verb correctMkdir C:\Users\mxgel\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
npm verb makeCacheDir UID & GID are irrelevant on win32
npm verb lock using C:\Users\mxgel\AppData\Roaming\npm-cache\_locks\staging-cfcdc7ee6147183b.lock for C:\code\Sutro\gatsby-gitbook-starter2\node_modules\.staging
npm timing action:extract Completed in 291ms
npm timing audit submit Completed in 321ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 324ms
npm timing audit body Completed in 4ms
npm timing action:finalize Completed in 19ms
npm timing action:refresh-package-json Completed in 93ms
npm info lifecycle file-uri-to-path#1.0.0~preinstall: file-uri-to-path#1.0.0
npm info lifecycle bindings#1.5.0~preinstall: bindings#1.5.0
npm info lifecycle semver#7.3.2~preinstall: semver#7.3.2
npm info lifecycle sharp#0.26.1~preinstall: sharp#0.26.1
npm timing action:preinstall Completed in 7ms
npm info linkStuff file-uri-to-path#1.0.0
npm info linkStuff bindings#1.5.0
npm info linkStuff semver#7.3.2
npm verb linkBins [
npm verb linkBins { semver: 'bin/semver.js' },
npm verb linkBins 'C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\sharp\\node_modules\\.bin',
npm verb linkBins false
npm verb linkBins ]
npm info linkStuff sharp#0.26.1
npm timing action:build Completed in 68ms
npm info lifecycle file-uri-to-path#1.0.0~install: file-uri-to-path#1.0.0
npm info lifecycle bindings#1.5.0~install: bindings#1.5.0
npm info lifecycle semver#7.3.2~install: semver#7.3.2
npm info lifecycle sharp#0.26.1~install: sharp#0.26.1
npm info lifecycle sharp#0.26.1~install: ignored because ignore-scripts is set to true sharp#0.26.1
npm timing action:install Completed in 32ms
npm info lifecycle file-uri-to-path#1.0.0~postinstall: file-uri-to-path#1.0.0
npm info lifecycle bindings#1.5.0~postinstall: bindings#1.5.0
npm info lifecycle semver#7.3.2~postinstall: semver#7.3.2
npm info lifecycle sharp#0.26.1~postinstall: sharp#0.26.1
npm timing action:postinstall Completed in 46ms
npm verb unlock done using C:\Users\mxgel\AppData\Roaming\npm-cache\_locks\staging-cfcdc7ee6147183b.lock for C:\code\Sutro\gatsby-gitbook-starter2\node_modules\.staging
npm timing stage:executeActions Completed in 648ms
npm timing stage:rollbackFailedOptional Completed in 1ms
npm timing stage:runTopLevelLifecycles Completed in 15394ms
npm verb saving [ { name: 'sharp', spec: '^0.26.1', save: 'dependencies' } ]
npm verb shrinkwrap skipping write for package.json because there were no changes.
npm info lifecycle undefined~preshrinkwrap: undefined
npm info lifecycle gatsby-gitbook-boilerplate#0.0.1~shrinkwrap: gatsby-gitbook-boilerplate#0.0.1
npm notice created a lockfile as package-lock.json. You should commit this file.
npm info lifecycle gatsby-gitbook-boilerplate#0.0.1~postshrinkwrap: gatsby-gitbook-boilerplate#0.0.1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules\babel-plugin-add-module-exports\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: win32
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.1 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: win32
npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
npm WARN acorn-class-fields#0.2.1 requires a peer of acorn#^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN acorn-dynamic-import#4.0.0 requires a peer of acorn#^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.17.1 requires a peer of typescript#>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must
install peer dependencies yourself.
+ sharp#0.26.1
added 4 packages from 66 contributors and audited 2666 packages in 16.799s
60 packages are looking for funding
run `npm fund` for details
found 1206 vulnerabilities (1157 low, 2 moderate, 47 high)
run `npm audit fix` to fix them, or `npm audit` for details
npm verb exit [ 0, true ]
npm timing npm Completed in 18411ms
npm info ok
Existing Stack Overflow Solutions
After some research, I found that ignoring scripts might be the issue. I've tried setting ignore-scripts to true using the following command:
npm install sharp --ignore-scripts
This still did not fix the issue, and threw the same error.
The, I tried deleting my entire node modules folder and the package-lock.json, and then the following command:
npm install --unsafe-perm
The Sharp Error was still thrown after using 'gatsby develop'
Some more research. Again, trying to see if it was related to NPM, I ran the following to no avail:
npm rebuild
I Even Tried Yarn
Removing all of my modules and retrying the entire process using yarn did not fix the issue. I'm only listing this as an attempt to illustrate my desperation. I can post some of the yarn results, but long story short the Sharp module just straightup refuses to let me download a certain package from the Sharp module when using the Yarn install methods. I was even able to trace it down to the exact tvg module that refused to download, but I have no way of fixing this.
Thanks again for your time and patience, and info helps!
#Ferran pointed me in the best direction: the Gatsby documentation.
Not sure what caused this error, but I completely reset my Windows 10 and then reinstalled Node, NPM, Gatsby from scratch.
All commands working fine now, with no sharp module errors! Must have been some environment conflicts on my drive.

Getting Bad Request (Http 400) when using npm dist-tag with Nexus 3.19.1-01

We are running Nexus OSS 3.19.1-01 (CentOS7 with OpenJdk 1.8.0_222-b10) with npm repository. Everything works fine except the npm dist-tag feature which should now work with version >3.19.
$ npm publish <pkg> --tag bla #--> works
$ npm install <pkg>#bla #--> works
$ npm dist-tag ls <pkg> #--> works
$ npm dist-tag rm --verbose #myscope/mypackage foo
npm info it worked if it ends with ok
npm verb cli [
npm verb cli '/usr/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'dist-tag',
npm verb cli 'rm',
npm verb cli '--verbose',
npm verb cli '#myscope/mypackage',
npm verb cli 'foo'
npm verb cli ]
npm info using npm#6.13.1
npm info using node#v12.13.0
npm verb npm-session 3b193197390df1cf
npm verb dist-tag del snapshot from #myscope/mypackage
npm http fetch GET 200 https://nexus.example.com/repository/npm-group/-/package/#myscope%2fmypackage/dist-tags 1396ms
npm http fetch DELETE 400 https://nexus.example.com/repository/npm-group/-/package/#myscope%2fmypackage/dist-tags/foo 9ms
npm verb stack Error: 400 Bad Request - DELETE https://nexus.example.com/repository/npm-group/-/package/#myscope%2fmypackage/dist-tags/foo
npm verb stack at /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:104:15
npm verb stack at processTicksAndRejections (internal/process/task_queues.js:93:5)
npm verb statusCode 400
npm verb pkgid #myscope/mypackage#latest
npm verb cwd /home/myname/path-to-code/mypackage/client
npm verb Linux 5.3.11-300.fc31.x86_64
npm verb argv "/usr/bin/node" "/usr/local/bin/npm" "dist-tag" "rm" "--verbose" "#myscope/mypackage" "foo"
npm verb node v12.13.0
npm verb npm v6.13.1
npm ERR! code E400
npm ERR! 400 Bad Request - DELETE https://nexus.example.com/repository/npm-group/-/package/#myscope%2fmypackage/dist-tags/foo
npm verb exit [ 1, true ]
npm timing npm Completed in 1730ms
npm ERR! A complete log of this run can be found in:
npm ERR! /home/myname/.npm/_logs/2019-11-20T13_02_41_234Z-debug.log
$ npm dist-tag add #myscope/mypackage#0.1.0 bar
# did not work, same error as above
No additional log messages in nexus log.
Any idea?
I'm afraid it won't work for you, because you're running your commands against npm group repository. Both npm dist-tag add and npm dist-tag rm work only for hosted repositories as of NXRM 3.19.1. However, npm dist-tag ls is supported by all types of repositories (since 3.19.0).

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

Initialising create-react-app with a specific version of a package

I am trying to initialise a create-react-app project.
Unfortunately this is failing when it attempts to fetch webpack-dev-server#3.1.14, as my company's internal NPM registry has decided that 3.1.14 has a vulnerability and so returns a 404.
How can I initialise create-react-app, and specify that it must use webpack-dev-server#3.1.13?
The following is the last 50 lines of the verbose output:
...
npm verb get http://myregistry:1234/jest not expired, no request
npm verb afterAdd c:\dev\npm-cache\eslint-plugin-react\7.11.1\package\package.json written
npm verb afterAdd c:\dev\npm-cache\jest\23.6.0\package\package.json not in flight; writing
npm verb correctMkdir c:\dev\npm-cache correctMkdir not in flight; initializing
npm verb cache add spec eslint#5.6.0
npm verb addNamed "5.6.0" is a plain semver version for eslint
npm verb addNameVersion registry:http://myregistry:1234/eslint not in flight; fetching
npm verb get http://myregistry:1234/eslint-plugin-flowtype not expired, no request
npm verb afterAdd c:\dev\npm-cache\jest\23.6.0\package\package.json written
npm verb afterAdd c:\dev\npm-cache\eslint-plugin-flowtype\2.50.1\package\package.json not in flight; writing
npm verb correctMkdir c:\dev\npm-cache correctMkdir not in flight; initializing
npm verb get http://myregistry:1234/webpack-dev-server not expired, no request
npm verb addRemoteTarball http://myregistry:1234/webpack-dev-server/-/webpack-dev-server-3.1.14.tgz not in flight; adding
npm verb addRemoteTarball [ 'http://myregistry:1234/webpack-dev-server/-/webpack-dev-server-3.1.14.tgz',
npm verb addRemoteTarball '60fb229b997fc5a0a1fc6237421030180959d469' ]
npm verb afterAdd c:\dev\npm-cache\eslint-plugin-flowtype\2.50.1\package\package.json written
npm verb get http://myregistry:1234/babel-core not expired, no request
npm verb get http://myregistry:1234/eslint not expired, no request
npm info retry fetch attempt 1 at 9:58:55 AM
npm info attempt registry request try #1 at 9:58:55 AM
npm http fetch GET http://myregistry:1234/webpack-dev-server/-/webpack-dev-server-3.1.14.tgz
npm verb afterAdd c:\dev\npm-cache\babel-core\7.0.0-bridge.0\package\package.json not in flight; writing
npm verb correctMkdir c:\dev\npm-cache correctMkdir not in flight; initializing
npm verb afterAdd c:\dev\npm-cache\eslint\5.6.0\package\package.json not in flight; writing
npm verb correctMkdir c:\dev\npm-cache correctMkdir not in flight; initializing
npm verb request uri http://myregistry:1234/webpack
npm verb request no auth needed
npm info attempt registry request try #1 at 9:58:55 AM
npm verb etag "3cb43ef0e59f247dfcf5f855611d5749"
npm http request GET http://myregistry:1234/webpack
npm verb afterAdd c:\dev\npm-cache\babel-core\7.0.0-bridge.0\package\package.json written
npm http fetch 404 http://myregistry:1234/webpack-dev-server/-/webpack-dev-server-3.1.14.tgz
npm ERR! fetch failed http://myregistry:1234/webpack-dev-server/-/webpack-dev-server-3.1.14.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm verb afterAdd c:\dev\npm-cache\eslint\5.6.0\package\package.json written
npm http 304 http://myregistry:1234/webpack
npm verb headers { 'x-powered-by': 'Sinopia/1.4.0',
npm verb headers etag: '"3cb43ef0e59f247dfcf5f855611d5749"',
npm verb headers 'x-status-cat': 'http://flic.kr/p/aXY3dH',
npm verb headers date: 'Tue, 22 Jan 2019 09:58:55 GMT',
npm verb headers connection: 'keep-alive' }
npm verb etag http://myregistry:1234/webpack from cache
npm verb get saving webpack to c:\dev\npm-cache\appduv03d1.machine.test.group_4873\webpack\.cache.json
npm verb correctMkdir c:\dev\npm-cache correctMkdir not in flight; initializing
npm verb cache add spec webpack#4.19.1
npm verb addNamed "4.19.1" is a plain semver version for webpack
npm verb addNameVersion registry:http://myregistry:1234/webpack not in flight; fetching
npm verb get http://myregistry:1234/webpack not expired, no request
npm verb afterAdd c:\dev\npm-cache\webpack\4.19.1\package\package.json not in flight; writing
npm verb correctMkdir c:\dev\npm-cache correctMkdir not in flight; initializing
npm verb afterAdd c:\dev\npm-cache\webpack\4.19.1\package\package.json written
npm info retry fetch attempt 2 at 9:59:05 AM
npm info attempt registry request try #1 at 9:59:05 AM
npm http fetch GET http://myregistry:1234/webpack-dev-server/-/webpack-dev-server-3.1.14.tgz
npm http fetch 404 http://myregistry:1234/webpack-dev-server/-/webpack-dev-server-3.1.14.tgz
npm ERR! fetch failed http://myregistry:1234/webpack-dev-server/-/webpack-dev-server-3.1.14.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
what is the error showing
simple way:if i am getting you
1.create-react-app my-app
2.cd my-app
3.npm i webpack-dev-server#3.1.13
4.if high severity vulnerability comes in just run npm audit fix to fix them, or npm audit for details
if any dependencies are migrated or has problem within you will find the solution in terminal msg,
i think it will work
$ npm set registry https://registry.npmjs.org
than clean cache
$ npm cache clean
$ npm rebuild
or it could be proxy server issue
try other internet connection