Failed at the spawn-sync@1.0.15 postinstall script 'node postinstall'.
Closed this issue · 24 comments
Hi there.
I encounter the below error when trying to install polymer-cli. I get the error "Failed at the spawn-sync@1.0.15 postinstall script 'node postinstall'".Please help. See the below traces for further details:
'sudo npm install -g polymer-cli
npm WARN deprecated graceful-fs@3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
/usr/local/bin/polymer -> /usr/local/lib/node_modules/polymer-cli/bin/polymer.js
dtrace-provider@0.6.0 install /usr/local/lib/node_modules/polymer-cli/node_modules/dtrace-provider
node scripts/install.js
sh: node: command not found
npm WARN install:dtrace-provider@0.6.0 dtrace-provider@0.6.0 install: node scripts/install.js
npm WARN install:dtrace-provider@0.6.0 spawn ENOENT
spawn-sync@1.0.15 postinstall /usr/local/lib/node_modules/polymer-cli/node_modules/spawn-sync
node postinstall
sh: node: command not found
/usr/local/lib
└── (empty)
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "polymer-cli"
npm ERR! node v4.4.7
npm ERR! npm v3.10.4
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! spawn-sync@1.0.15 postinstall: node postinstall
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the spawn-sync@1.0.15 postinstall script 'node postinstall'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs spawn-sync
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/lenkwe/Sanlam/Mobile/Ionic/npm-debug.log
npm ERR! code 1'
Happened to me too... in recent distributions many packages install nodejs
as the node.js executable, while spawn-sync attempts to call node
, that is why this fails.
As a workaround, you can create a softlink from node
to nodejs
. Something like:
sudo ln -s `which nodejs` /usr/bin/node
thanks for the response. Though, the issue still persist. Please log traces:
MacBook-Pro:node_modules user$ sudo ln -s `which nodejs` /usr/local/bin/node Password: MacBook-Pro:node_modules user$ sudo npm install -g polymer-cli npm WARN deprecated graceful-fs@3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0. npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade /usr/local/bin/polymer -> /usr/local/lib/node_modules/polymer-cli/bin/polymer.js > dtrace-provider@0.6.0 install /usr/local/lib/node_modules/polymer-cli/node_modules/dtrace-provider > node scripts/install.js sh: node: command not found npm WARN install:dtrace-provider@0.6.0 dtrace-provider@0.6.0 install: `node scripts/install.js` npm WARN install:dtrace-provider@0.6.0 spawn ENOENT > spawn-sync@1.0.15 postinstall /usr/local/lib/node_modules/polymer-cli/node_modules/spawn-sync > node postinstall sh: node: command not found /usr/local/lib └── (empty) npm ERR! Darwin 15.5.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "polymer-cli" npm ERR! node v6.2.2 npm ERR! npm v3.9.5 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! spawn-sync@1.0.15 postinstall: `node postinstall` npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the spawn-sync@1.0.15 postinstall script 'node postinstall'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the spawn-sync package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node postinstall npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs spawn-sync npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls spawn-sync npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /usr/local/lib/node_modules/npm-debug.log npm ERR! code 1
On Fri, Jul 8, 2016 at 12:58 PM, Svarog notifications@github.com wrote:
Happened to me too... in recent distributions many packages install nodejs
as the node.js executable, while spawn-sync attempts to call node, that
is why this fails.As a workaround, you can create a softlink from node to nodejs. Something
like:sudo ln -s
which nodejs
/usr/bin/node—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#42 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ATWU4q4Vz1dskrEdg0yUlHJFXK7JD4ycks5qTi1vgaJpZM4JEqGJ
.
Name: Lenkwe
Cell no: 0837670008
Same issue here on fresh installs of Debian or Ubuntu. I'm testing with Docker images node:latest
(the official NodeJS release using Debian) and ubuntu:latest
(fresh install, installed Node/NPM with n
).
$ which node
/root/n/bin/node
$ which nodejs
# none
$ node -v
v6.2.2
$ npm -v
3.9.5
Then (as root)...
$ npm i -g spawn-sync # same issue with or without -g
> spawn-sync@1.0.15 postinstall /root/n/lib/node_modules/spawn-sync
> node postinstall
sh: 1: node: Permission denied
npm ERR! Linux 4.2.0-18-generic
npm ERR! argv "/root/n/bin/node" "/root/n/bin/npm" "i" "-g" "spawn-sync"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! spawn-sync@1.0.15 postinstall: `node postinstall`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the spawn-sync@1.0.15 postinstall script 'node postinstall'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs spawn-sync
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /npm-debug.log
This issue does NOT happen on OSX or Windows for me (using the same versions of Node/NPM).
Any suggestions would be greatly appreciated.
/usr/local/bin/mean -> /usr/local/lib/node_modules/mean-cli/bin/mean
/usr/local/bin/mean-init -> /usr/local/lib/node_modules/mean-cli/bin/mean-init
/usr/local/bin/mean-authorize -> /usr/local/lib/node_modules/mean-cli/bin/mean-authorize
/usr/local/bin/mean-whoami -> /usr/local/lib/node_modules/mean-cli/bin/mean-whoami
/usr/local/bin/mean-login -> /usr/local/lib/node_modules/mean-cli/bin/mean-login
/usr/local/bin/mean-addKey -> /usr/local/lib/node_modules/mean-cli/bin/mean-addKey
/usr/local/bin/mean-publish -> /usr/local/lib/node_modules/mean-cli/bin/mean-publish
/usr/local/bin/mean-search -> /usr/local/lib/node_modules/mean-cli/bin/mean-search
/usr/local/bin/mean-register -> /usr/local/lib/node_modules/mean-cli/bin/mean-register
/usr/local/bin/mean-postinstall -> /usr/local/lib/node_modules/mean-cli/bin/mean-postinstall
/usr/local/bin/mean-preinstall -> /usr/local/lib/node_modules/mean-cli/bin/mean-preinstall
/usr/local/bin/mean-install -> /usr/local/lib/node_modules/mean-cli/bin/mean-install
/usr/local/bin/mean-uninstall -> /usr/local/lib/node_modules/mean-cli/bin/mean-uninstall
/usr/local/bin/mean-docs -> /usr/local/lib/node_modules/mean-cli/bin/mean-docs
/usr/local/bin/mean-package -> /usr/local/lib/node_modules/mean-cli/bin/mean-package
/usr/local/bin/mean-list -> /usr/local/lib/node_modules/mean-cli/bin/mean-list
/usr/local/bin/mean-status -> /usr/local/lib/node_modules/mean-cli/bin/mean-status
/usr/local/bin/mean-user -> /usr/local/lib/node_modules/mean-cli/bin/mean-user
/usr/local/bin/mean-logout -> /usr/local/lib/node_modules/mean-cli/bin/mean-logout
/usr/local/bin/mean-disable -> /usr/local/lib/node_modules/mean-cli/bin/mean-disable
/usr/local/bin/mean-enable -> /usr/local/lib/node_modules/mean-cli/bin/mean-enable
spawn-sync@1.0.15 postinstall /usr/local/lib/node_modules/mean-cli/node_modules/spawn-sync
node postinstall
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
path.js:1144
cwd = process.cwd();
^
Error: EACCES: permission denied, uv_cwd
at Error (native)
at Object.resolve (path.js:1144:25)
at startup (bootstrap_node.js:122:32)
at bootstrap_node.js:467:3
/usr/local/lib
└── (empty)
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/6.3.1/bin/node" "/usr/local/bin/npm" "install" "-g" "mean-cli"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! spawn-sync@1.0.15 postinstall: node postinstall
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spawn-sync@1.0.15 postinstall script 'node postinstall'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs spawn-sync
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/troy/npm-debug.log
npm ERR! code 1
Hi there,
Here is how I resolved this issue:
- I check the postinstall.js and saw that it is trying to
install try-thread-sleep. So I installed it manually. - Then I executed the main install with --ignore-scripts spawn-sync as
stated in the readme file (
https://github.com/ForbesLindesay/spawn-sync/blob/master/README.md).
I hope this helps.
Thanks,
Lenkwe
On Sun, Jul 31, 2016 at 10:02 PM, Troy notifications@github.com wrote:
/usr/local/bin/mean -> /usr/local/lib/node_modules/mean-cli/bin/mean
/usr/local/bin/mean-init ->
/usr/local/lib/node_modules/mean-cli/bin/mean-init
/usr/local/bin/mean-authorize ->
/usr/local/lib/node_modules/mean-cli/bin/mean-authorize
/usr/local/bin/mean-whoami ->
/usr/local/lib/node_modules/mean-cli/bin/mean-whoami
/usr/local/bin/mean-login ->
/usr/local/lib/node_modules/mean-cli/bin/mean-login
/usr/local/bin/mean-addKey ->
/usr/local/lib/node_modules/mean-cli/bin/mean-addKey
/usr/local/bin/mean-publish ->
/usr/local/lib/node_modules/mean-cli/bin/mean-publish
/usr/local/bin/mean-search ->
/usr/local/lib/node_modules/mean-cli/bin/mean-search
/usr/local/bin/mean-register ->
/usr/local/lib/node_modules/mean-cli/bin/mean-register
/usr/local/bin/mean-postinstall ->
/usr/local/lib/node_modules/mean-cli/bin/mean-postinstall
/usr/local/bin/mean-preinstall ->
/usr/local/lib/node_modules/mean-cli/bin/mean-preinstall
/usr/local/bin/mean-install ->
/usr/local/lib/node_modules/mean-cli/bin/mean-install
/usr/local/bin/mean-uninstall ->
/usr/local/lib/node_modules/mean-cli/bin/mean-uninstall
/usr/local/bin/mean-docs ->
/usr/local/lib/node_modules/mean-cli/bin/mean-docs
/usr/local/bin/mean-package ->
/usr/local/lib/node_modules/mean-cli/bin/mean-package
/usr/local/bin/mean-list ->
/usr/local/lib/node_modules/mean-cli/bin/mean-list
/usr/local/bin/mean-status ->
/usr/local/lib/node_modules/mean-cli/bin/mean-status
/usr/local/bin/mean-user ->
/usr/local/lib/node_modules/mean-cli/bin/mean-user
/usr/local/bin/mean-logout ->
/usr/local/lib/node_modules/mean-cli/bin/mean-logout
/usr/local/bin/mean-disable ->
/usr/local/lib/node_modules/mean-cli/bin/mean-disable
/usr/local/bin/mean-enable ->
/usr/local/lib/node_modules/mean-cli/bin/mean-enablespawn-sync@1.0.15 postinstall
/usr/local/lib/node_modules/mean-cli/node_modules/spawn-sync
node postinstallshell-init: error retrieving current directory: getcwd: cannot access
parent directories: Permission denied
path.js:1144
cwd = process.cwd();
^Error: EACCES: permission denied, uv_cwd
at Error (native)
at Object.resolve (path.js:1144:25)
at startup (bootstrap_node.js:122:32)
at bootstrap_node.js:467:3
/usr/local/lib
└── (empty)npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/6.3.1/bin/node" "/usr/local/bin/npm"
"install" "-g" "mean-cli"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLEnpm ERR! spawn-sync@1.0.15 postinstall: node postinstall
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spawn-sync@1.0.15 postinstall script 'node
postinstall'.
npm ERR! Make sure you have the latest version of node.js and npm
installed.
npm ERR! If you do, this is most likely a problem with the spawn-sync
package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall
npm ERR! You can get information on how to open an issue for this project
with:
npm ERR! npm bugs spawn-sync
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request:
npm ERR! /Users/troy/npm-debug.log
npm ERR! code 1—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#42 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATWU4osJb5zuPI5TT5VxYDPQ100uBM1-ks5qbP9JgaJpZM4JEqGJ
.
Name: Lenkwe
Cell no: 0837670008
yay!! this works. thanks so much. but where did you find this postinstall.js file?
https://github.com/ForbesLindesay/spawn-sync/blob/master/postinstall.js
On Mon, Aug 1, 2016 at 12:09 PM, Troy notifications@github.com wrote:
yay!! this works. thanks so much. but where did you find this
postinstall.js file?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#42 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATWU4pee2CGcTpWhvjZ5PhIBSYADr6Jpks5qbcXigaJpZM4JEqGJ
.
Name: Lenkwe
Cell no: 0837670008
I was able to solve this by running:
sudo apt-get install nodejs-legacy
Previous to installation, "node" wasn't even a recognized command.
Thanks @michaellandi, your tip worked perfectly here. Fresh Ubuntu 16.04 install.
@michaellandi it worked for me. Thanks for the advice. Appreciated!
Is this postinstall script even necessary? Why is it run as both prepublish and postinstall?
As far as I can tell, this is just adding a conditional dependency. Could it not be declared explicitly as a dependency (or, perhaps, optional-dependency)? It seems weird to be optimising for a case that most consumers won't encounter at the expense of failing installs for anyone using this module in a CI environment.
RHEL 7 CENTOS 7 Failed at the spawn-sync@1.0.15 postinstall script 'node postinstall'. ember-cli
Thanks Forbes for your solution.
I have been trying to install ember 2.x on a RHEL 7 machine and getting this error.
Having exhausted all the possible solutions on the net I realized I was being thick in my interpretation of npm install -- ignore-script spawn-sync
npm install -g ember-cli FAILS with error
npm install -g --ignore-scripts ember-cli
installed w/o incident
$ ember -v
ember-cli: 2.10.0
node: 6.9.4
os: linux x64
@ajhyndman This only breaks in really astonishingly broken environments, e.g. where running node
doesn't run the node executable. Unfortunately, because of the popularity of the module, we are encountering a lot of these extremely broken environments.
The postinstall script is optimising for the very common case that a user is running a recent version of node.js and therefore doesn't need to install these dependencies (in this situation it is about 1000x faster to run the postinstall script than install the unused dependency) and the other moderately common case where the user is on an old version of node (and installing the optional dependency reduces CPU usage by about 100x with no other detrimental effects).
The only case where this is a problem is if your environment is not capable of running postinstall scripts.
Astonishingly broken? I've just installed a fresh node on a fresh Debian 6 using nvm and I run into this error. I've spent hours trying to fix it, unsuccessfully :(
i met this postinstall issue in my fresh ubuntu 16.04, node 8.0.0
my workaround:
- fallback to nodejs 6.10.3
- apt-get install nodejs-legacy
- delete the node of /usr/bin/node, i think it's from nodejs-legacy, since it showed node version
4.10.x, and - ln -s {nodejs 6.10.3/bin}/node /usr/bin/node
@WillisZhang FYI, I'm also using node 8 on Ubuntu 16.04.
After trying apt-get install nodejs-legacy
, it works.
Would it be possible to take a polyfill approach here? If we are on a recent version of node, defer to the built-in node functionality; if not, use spawn-sync
's implementation.
This seems like an approach that could eliminate most of the issues that are bringing people to this thread.
@svarogg i love u!!!
Worked for me on Linux Mint 18.1 64-bit
However I cannot understand why the default installation of Node is not resolving the globally set nodejs executable?
Anyone care to help out a mostly .NET developer here? ;)
@michaellandi
Your solution still works! Ubuntu 17.04
Thank you!
$ ln -s which nodejs
/xampp/htdocs/nodejs/node
which: no nodejs in (/c/Users/aswathy/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/DOWS/System32/WindowsPowerShell/v1.0:/d/java:/c/Namitha backup/sdk/platform-tool:/c/Users/aswathy/AppData/Roaming/npm/ng:/c/Users/aswathy/AppData/Roaming/npm:/cr:/c/Users/aswathy/AppData/Roaming/npm/ng:/c/xampp/htdocs:/usr/bin:/c/Users/aswa
ln: failed to create symbolic link './node': No such file or directory
This is just to reproduce the error, not necessarily the best way to do things in production, but you get the idea.
To reproduce:
Create an Ubuntu 16.04 or 17.10 x64 instance on Digital Ocean
as root install node with nvm and try to install spawn-sync globally
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
nvm install node # install latest Nodejs
npm install -g spawn-sync
Issue is 100% reproducible with error:
> spawn-sync@1.0.15 postinstall /root/.nvm/versions/node/v9.8.0/lib/node_modules/spawn-sync
> node postinstall
sh: 1: node: Permission denied
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! spawn-sync@1.0.15 postinstall: `node postinstall`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the spawn-sync@1.0.15 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! /root/.npm/_logs/2018-03-17T18_22_55_288Z-debug.log
The log /root/.npm/_logs/2018-03-17T18_22_55_288Z-debug.log is attached as spawn-sync_error.log
I ran across this attempting the standard install for Serverless. So that is another way to reproduce this error reliably.
The latest version is just a stub with no postinstall script. It does require upgrading to a recent version of node.js