Installation npm install error

I followed instruction in https://github.com/sharetribe/sharetribe to install. It works on VM but when I followed exact instruction on AWS. It gave me the following error. I tried both latest and v6.1.0 release. They both failed the same way, Error log is shown below. I will appreciate any help. thanks.

ubuntu@ip-172-31-28-102:~/sharetribe$ npm install

undefined postinstall /home/ubuntu/sharetribe
cd client && npm install

npm WARN deprecated babel-preset-latest@6.14.0: :boom: preset-latest accomplishes the same task as babel-preset-env. :pray: Please install it with ā€˜npm install babel-preset-env --save-devā€™. ā€˜{ ā€œpresetsā€: [ā€œlatestā€] }ā€™ to ā€˜{ ā€œpresetsā€: [ā€œenvā€] }ā€™. For more info, please check the docs: http://babeljs.io/docs/plugins/preset-env :ok_hand:. And let us know how youā€™re liking Babel at @babeljs on :bird:
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
npm WARN prefer global colorguard@1.2.0 should be installed with -g
npm WARN prefer global node-gyp@3.5.0 should be installed with -g

node-sass@3.10.1 install /home/ubuntu/sharetribe/client/node_modules/node-sass
node scripts/install.js

npm ERR! Linux 3.13.0-107-generic
npm ERR! argv ā€œ/home/ubuntu/.nvm/versions/node/v6.9.5/bin/nodeā€ ā€œ/home/ubuntu/.nvm/versions/node/v6.9.5/bin/npmā€ ā€œinstallā€
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR!

cat /home/ubuntu/sharetribe/npm-debug.log
38 verbose lock using /home/ubuntu/.npm/_locks/staging-09996f038131cf05.lock for /home/ubuntu/sharetribe/node_modules/.staging
39 silly doParallel extract 0
40 silly doParallel preinstall 0
41 silly doReverseSerial remove 0
42 silly doSerial move 0
43 silly doSerial finalize 0
44 silly doSerial build 0
45 silly doSerial global-link 0
46 silly doParallel update-linked 0
47 silly doSerial install 0
48 silly doSerial postinstall 0
49 verbose unlock done using /home/ubuntu/.npm/_locks/staging-09996f038131cf05.lock for /home/ubuntu/sharetribe/node_modules/.staging
50 silly executeActions Finishing
51 silly rollbackFailedOptional Starting
52 silly rollbackFailedOptional Finishing
53 silly install runPostinstallTopLevelLifecycles
54 silly build sharetribe
55 info linkStuff !invalid#1
56 silly linkStuff !invalid#1 has /home/ubuntu as its parent node_modules
57 verbose linkBins !invalid#1
58 verbose linkMans !invalid#1
59 silly install sharetribe /home/ubuntu/sharetribe/sharetribe-b1a1c93b
60 info lifecycle undefined~install: undefined
61 silly lifecycle undefined~install: no script for install, continuing
62 silly postinstall sharetribe /home/ubuntu/sharetribe/sharetribe-b1a1c93b
63 info lifecycle undefined~postinstall: undefined
64 verbose lifecycle undefined~postinstall: unsafe-perm in lifecycle true
65 verbose lifecycle undefined~postinstall: PATH: /home/ubuntu/.nvm/versions/node/v6.9.5/lib/node_modules/npm/bin/node-gyp-bin:/home/ubuntu/sharetribe/node_modules/.bin:/home/ubuntu/.nvm/versions/node/v6.9.5/bin:/home/ubuntu/.rbenv/plugins/ruby-build/bin:/home/ubuntu/.rbenv/shims:/home/ubuntu/.rbenv/bin:/home/ubuntu/.rbenv/plugins/ruby-build/bin:/home/ubuntu/.rbenv/shims:/home/ubuntu/.rbenv/bin:/home/ubuntu/.rbenv/plugins/ruby-build/bin:/home/ubuntu/.rbenv/shims:/home/ubuntu/.rbenv/bin:/home/ubuntu/.rbenv/shims:/home/ubuntu/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
66 verbose lifecycle undefined~postinstall: CWD: /home/ubuntu/sharetribe
67 silly lifecycle undefined~postinstall: Args: [ ā€˜-cā€™, ā€˜cd client && npm installā€™ ]
68 silly lifecycle undefined~postinstall: Returned: code: 1 signal: null
69 info lifecycle undefined~postinstall: Failed to exec postinstall script
70 verbose stack Error: undefined postinstall: cd client && npm install
70 verbose stack Exit status 1

1 Like

That looks like a bit cryptic error message without much hint where the error might beā€¦

When you run npm install in the root, it doesnā€™t actually do much. It only cds to the client directory and runs npm install there. So you could try if it helps if you manually cd client and then run npm install in the client directory. Also, might be good idea to clean node_modules directories.

So try these commands:

sharetribe> rm -rf node_modules
sharetribe> cd client
client> rm -rf node_modules
client> npm install

Please let me know if these commands solve the issue! If thatā€™s the case, we might need to change the installation instructions a bit.

1 Like

Having the same error here, only on AWS, have you solved it?

thanks

I tried this with a fresh Ubuntu 16.04 EC2 instance in Amazon. I followed the instructions here: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions on how to install Node with package manager and got the npm install working.

I didnā€™t test the whole setup, but at least the npm install should work in Amazon.

I tried
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

I got the same error below

50 silly executeActions Finishing
51 silly rollbackFailedOptional Starting
52 silly rollbackFailedOptional Finishing
53 silly install runPostinstallTopLevelLifecycles
54 silly build sharetribe
55 info linkStuff !invalid#1
56 silly linkStuff !invalid#1 has /home/ubuntu as its parent node_modules
57 verbose linkBins !invalid#1
58 verbose linkMans !invalid#1
59 silly install sharetribe /home/ubuntu/sharetribe/sharetribe-b1a1c93b
60 info lifecycle undefined~install: undefined
61 silly lifecycle undefined~install: no script for install, continuing
62 silly postinstall sharetribe /home/ubuntu/sharetribe/sharetribe-b1a1c93b
63 info lifecycle undefined~postinstall: undefined
64 verbose lifecycle undefined~postinstall: unsafe-perm in lifecycle true
65 verbose lifecycle undefined~postinstall: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/ubuntu/sharetribe/node_modules/.bin:/home/ubuntu/.rvm/gems/ruby-2.3.1/bin:/home/ubuntu/.rvm/gems/ruby-2.3.1@global/bin:/home/ubuntu/.rvm/rubies/ruby-2.3.1/bin:/home/ubuntu/.rvm/bin:/home/ubuntu/bin:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
66 verbose lifecycle undefined~postinstall: CWD: /home/ubuntu/sharetribe
67 silly lifecycle undefined~postinstall: Args: [ ā€˜-cā€™, ā€˜cd client && npm installā€™ ]
68 silly lifecycle undefined~postinstall: Returned: code: 137 signal: null
69 info lifecycle undefined~postinstall: Failed to exec postinstall script
70 verbose stack Error: undefined postinstall: cd client && npm install
70 verbose stack Exit status 137
70 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
70 verbose stack at emitTwo (events.js:106:13)
70 verbose stack at EventEmitter.emit (events.js:191:7)
70 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
70 verbose stack at emitTwo (events.js:106:13)
70 verbose stack at ChildProcess.emit (events.js:191:7)
70 verbose stack at maybeClose (internal/child_process.js:886:16)
70 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
71 verbose cwd /home/ubuntu/sharetribe
72 error Linux 4.4.0-64-generic
73 error argv ā€œ/usr/bin/nodejsā€ ā€œ/usr/bin/npmā€ ā€œinstallā€
74 error node v6.10.2
75 error npm v3.10.10
76 error code ELIFECYCLE
77 error undefined postinstall: cd client && npm install
77 error Exit status 137
78 error Failed at the undefined postinstall script ā€˜cd client && npm installā€™.
78 error Make sure you have the latest version of node.js and npm installed.
78 error If you do, this is most likely a problem with the package,
78 error not with npm itself.
78 error Tell the author that this fails on your system:
78 error cd client && npm install
78 error You can get information on how to open an issue for this project with:
78 error npm bugs
78 error Or if that isnā€™t available, you can get their info via:
78 error npm owner ls
78 error There is likely additional logging output above.
79 verbose exit [ 1, true ]

Hi gordy123,
Iā€™m no expert more like ā€œamateur eclaireā€ as we say in french and go with ā€œtrial and errorā€ without really knowing why it works or not :smile:
At some point I had the same kind of error, I didnā€™t write down exactly why and how, but my ā€œcurrent workingā€ install procedure on fresh EC2 AWS UBUNTU 16.04 instance for node 6.9 is:

curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g n
sudo n 6.9.5

I do this before downloawding sharetribe so client dir doesnā€™t exist and I have to ā€œreinstallā€ npm later.

If anyone has any enlightening comments on why it works please let me know!

Sorry it didnā€™t improve too much.
Here are the steps that I took to set up the environment.
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g n
sudo n 6.9.5
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev nodejs
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm install 2.3.1
rvm use 2.3.1 --default
sudo apt-get install libmysqlclient-dev
sudo apt-get install libsqlite3-dev
sudo apt-get update
gem update --system
gem install bundler
gem install rails -v 4.2
sudo apt-get install mysql-client-5.7 mysql-server-5.7
sudo apt-get install sphinxsearch
sudo apt-get install imagemagick
git clone git://github.com/sharetribe/sharetribe.git
cd sharetribe/
cp config/database.example.yml config/database.yml
cp config/config.example.yml config/config.yml
bundle install
npm install

then I got the same error at this point. Did I miss any steps ? Any help will be appreciated ?

thanks, Gordon

@gordy123
I more or less have the same procedure (the order of installs is some times different) but I am currently working on a modified version of sharetribe and seem to get some specific errors.

when I get this error in npm install ā€œundefined: cd client && npm installā€ I do as rap1ds suggested

cd client
npm install

at this point either it worksā€¦ great :smile:

or ā€¦I can have a new ERR
"ERROR in ENOENT: no such file or directory, scandir ā€˜/home/ec2-user/sharetribe/client/node_modules/node-sass/vendorā€™
@ ./~/react-dates/css/styles.scss "

for this one
make sure you are in client dir and then

cd node_modules
npm rebuild node-sass
cd ā€¦/ā€¦
last one to get back to sharetribe dir

before doing bundle install I have configured my config.yml and database.yml files

Let me know how it goes
Xavier

new error after
cd client
npm install

npm ERR! Linux 4.4.0-64-generic
npm ERR! argv ā€œ/usr/local/bin/nodeā€ ā€œ/usr/local/bin/npmā€ "install"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code EBADPLATFORM

npm ERR! notsup Unsupported platform for fsevents@1.0.14: wanted {ā€œosā€:ā€œdarwinā€,ā€œarchā€:ā€œanyā€} (current: {ā€œosā€:ā€œlinuxā€,ā€œarchā€:ā€œx64ā€})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64

npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/sharetribe/client/npm-debug.log

Hi

Never had that canā€™t give any clue ( search google some seem to have had the same error), maybe best to startover clean!

Sorry canā€™t help on that
Xavier

Hey so to fix this error you enter the following commands.
npm install -g npm@latest
once you have installed
execute the following command
npm install -g npm@4.2.0
You will then have no errors when you execute RAILS_ENV=production NODE_ENV=production bundle exec rake assets:precompile