npm-installer
npm-installer copied to clipboard
Can't install using NodeJS' snap
Versions
node --version
v11.14.0
npm --version
6.9.0
Operating System
OS: Ubuntu 18.04.2 LTS x86_64
Kernel: 4.15.0-48-generic
Uptime: 23 hours, 45 mins
Packages: 2578
Shell: bash 4.4.19
Resolution: 1920x1080, 1920x1080, 1920x1080
DE: Unity
WM: GNOME Shell
WM Theme: Adwaita
Theme: Adwaita-dark [GTK2/3]
Icons: Adwaita [GTK2/3]
Terminal: vscode
CPU: AMD Ryzen 3 1200 (4) @ 3.100GHz
GPU: NVIDIA GeForce GTX 1050
Memory: 5060MiB / 16039MiB
Error
sudo npm i -g nw
/usr/local/bin/nw -> /usr/local/lib/node_modules/nw/bin/nw
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/1935/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> [email protected] postinstall /usr/local/lib/node_modules/nw
> node scripts/install.js
2019/04/17 16:08:17.508260 cmd_run.go:876: WARNING: cannot create user data directory: cannot create "/nonexistent/snap/node/1935": mkdir /nonexistent: permission denied
cannot create user data directory: /nonexistent/snap/node/1935: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall 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! /home/natoboram/.npm/_logs/2019-04-17T20_08_17_611Z-debug.log
same issue, some log
Steps to reproduce:
- install clean ubuntu 19.04
- install node via snap
node -v
v10.15.3
node 10.15.3 1793 10 nodesource✓ classic
npm -v
6.4.1
- run script:
sudo npm install -g @vue/cli
19164 warn lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/1793/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
19165 verbose lifecycle [email protected]~postinstall: unsafe-perm in lifecycle false
19166 verbose lifecycle [email protected]~postinstall: PATH: /snap/node/1793/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/local/lib/node_modules/@vue/cli/node_modules/protobufjs/node_modules/.bin:/usr/local/lib/node_modules/@vue/cli/node_modules/.bin:/usr/local/lib/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
19167 verbose lifecycle [email protected]~postinstall: CWD: /usr/local/lib/node_modules/@vue/cli/node_modules/protobufjs
19168 silly lifecycle [email protected]~postinstall: Args: [ '-c', 'node scripts/postinstall' ]
19169 silly lifecycle [email protected]~postinstall: Returned: code: 1 signal: null
19170 info lifecycle [email protected]~postinstall: Failed to exec postinstall script
19171 timing action:postinstall Completed in 90ms
19172 verbose unlock done using /home/neo/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
19173 timing stage:rollbackFailedOptional Completed in 781ms
19174 timing stage:runTopLevelLifecycles Completed in 11197ms
19175 warn [email protected] requires a peer of vue@^2.5.21 but none is installed. You must install peer dependencies yourself.
19176 warn [email protected] requires a peer of typescript@>=2.0 but none is installed. You must install peer dependencies yourself.
19177 warn [email protected] requires a peer of [email protected] - 14.1.x but none is installed. You must install peer dependencies yourself.
19178 warn [email protected] requires a peer of vue@^2.3.0 but none is installed. You must install peer dependencies yourself.
19179 warn optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@vue/cli/node_modules/fsevents):
19180 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
19181 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin
19181 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any
19181 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: linux
19181 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
19182 verbose stack RangeError: Maximum call stack size exceeded
19182 verbose stack at RegExp.test (<anonymous>)
19182 verbose stack at isDepOptional (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:405:45)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:414:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19182 verbose stack at failedDependency (/snap/node/1793/lib/node_modules/npm/lib/install/deps.js:430:9)
19183 verbose cwd /home/neo/code/web-debug-vue-scheme-render
19184 verbose Linux 5.0.0-13-generic
19185 verbose argv "/snap/node/1793/bin/node" "/snap/node/1793/bin/npm" "install" "-g" "@vue/cli"
19186 verbose node v10.15.3
19187 verbose npm v6.4.1
19188 error Maximum call stack size exceeded
19189 verbose exit [ 1, true ]
I was running into the same issue and was able to resolve by running the following:
npm config set scripts-prepend-node-path true
ditched the snap. curled the repo and installed via apt. for anyone who just needs it to work
it's late but the problem is snap permission install it via binary archived file i had same issue and you can install via apt but it's old version also it's the tutorial for it. https://github.com/nodejs/help/wiki/Installation