Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Failed on Raspberry Pi #165

Closed
hightechlofi opened this issue Jul 11, 2013 · 14 comments
Closed

Test Failed on Raspberry Pi #165

hightechlofi opened this issue Jul 11, 2013 · 14 comments

Comments

@hightechlofi
Copy link

I have installed node.js 0.10.12 and then installed node-sqlite3. When I run npm test I get the following:

sqlite3@2.1.12 pretest /node-sqlite3
make db

Creating test database... This may take several minutes.
/bin/sh: 3: node: not found
make: *** [db] Error 127

npm ERR! sqlite3@2.1.12 pretest: make db
npm ERR! sh "-c" "make db" failed with 2
npm ERR!
npm ERR! Failed at the sqlite3@2.1.12 pretest script.
npm ERR! This is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! make db
npm ERR! You can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 3.1.9adafruit+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "test"
npm ERR! cwd /node-sqlite3
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! code ELIFECYCLE
npm ERR! message sqlite3@2.1.12 pretest: make db
npm ERR! message sh "-c" "make db" failed with 2
npm ERR! errno {}
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
npm WARN /usr/share/doc/nodejs/README.Debian
npm WARN
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /node-sqlite3/npm-debug.log
npm not ok

The log reads as follows:

nfo it worked if it ends with ok
verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'test' ]
info using npm@1.1.4
info using node@v0.6.19
verbose config file /root/.npmrc
verbose config file /usr/etc/npmrc
verbose config file /usr/share/npm/npmrc
verbose caching /node-sqlite3/package.json
verbose loadDefaults sqlite3@2.1.12
verbose run-script [ 'pretest', 'test', 'posttest' ]
info pretest sqlite3@2.1.12
verbose unsafe-perm in lifecycle true
silly exec sh "-c" "make db"
silly spawning [ 'sh', [ '-c', 'make db' ], '/node-sqlite3' ]
info sqlite3@2.1.12 Failed to exec pretest script
ERR! sqlite3@2.1.12 pretest: make db
ERR! sh "-c" "make db" failed with 2
ERR!
ERR! Failed at the sqlite3@2.1.12 pretest script.
ERR! This is most likely a problem with the sqlite3 package,
ERR! not with npm itself.
ERR! Tell the author that this fails on your system:
ERR! make db
ERR! You can get their info via:
ERR! npm owner ls sqlite3
ERR! There is likely additional logging output above.
ERR!
ERR! System Linux 3.1.9adafruit+
ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "test"
ERR! cwd /node-sqlite3
ERR! node -v v0.6.19
ERR! npm -v 1.1.4
ERR! code ELIFECYCLE
ERR! message sqlite3@2.1.12 pretest: make db
ERR! message sh "-c" "make db" failed with 2
ERR! errno {}
verbose exit [ 1, true ]

I am extremely new to all of this, so I could have easily screwed it up myself. From a fresh raspi I did the following to install:

sudo apt-get install nodejs npm node-semver

then per the build instructions:

git clone git://github.com/developmentseed/node-sqlite3.git
cd node-sqlite3
npm install

and

npm install mocha
npm test

After the first npm test failure I ran sudo apt-get install sqlite3 as I thought maybe I needed to, hope that didn't screw things up.

Any help would be greatly appreciated.

Thanks!

@springmeyer
Copy link
Contributor

This is happening because it appears your node.js binary is called nodejs instead of node. This is something we should avoid hardcoding in our test scripts. Until then you can likely workaround the problem by doing:

alias node=nodejs
npm test

@elgs
Copy link

elgs commented Jul 11, 2013

I had the same problem and it end up being that you had a much older version of nodejs installed by the apt-get, which in your case reads:

npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4

What I did to solve this problem is to remove them, by:

sudo apt-get remove node (or nodejs, I'm not very sure, you may try the other one if one failed)
sudo apt-get remove npm

This should remove your old version of node and npm, then try npm install sqlite3 again.

This is the link to my issue: #163

@hightechlofi
Copy link
Author

Thank you for the quick responses. Elgs - after I remove node and npm, all I have to do is run npm install sqlite3? Sorry I am such I newb!

@elgs
Copy link

elgs commented Jul 11, 2013

Yes. However, it may take a long time to build the whole thing, which took 30 minutes on my RPi, you may refer to the link I provided #163, at the bottom of that thread, @springmeyer has given a way to avoid long compiling time. See if that helps you.

@hightechlofi
Copy link
Author

I am still getting errors (after trying the alias). This is the first thing I am doing with my raspi, what would the "correct" steps be to set up node.js, sqlite3, and node-sqlite3 on my pi if I started with a clean install? I would not lose anything if I started over fresh (if that would be easier).

@elgs
Copy link

elgs commented Jul 11, 2013

I don't believe the alias thing is the cause of this problem. The real problem is that you have a hidden old version of node installed by apt-get. Try remove them and install it again using the one you downloaded from the nodejs website.

@hightechlofi
Copy link
Author

After uninstall/reinstall as per above, do I need to reinstall node-sqlite3, or is it still okay as is?

@springmeyer
Copy link
Contributor

@elgs - note that the error was:

Creating test database... This may take several minutes.
/bin/sh: 3: node: not found

@springmeyer
Copy link
Contributor

btw, I have no personal experience with rasp pi, so I'm going to close this issue. You two feel free to share ideas still however.

@hightechlofi
Copy link
Author

Thanks for your help springmeyer!

@elgs
Copy link

elgs commented Jul 11, 2013

@hightechlofi yes, after uninstall node/npm with sudo apt-get remove, you need to reinstall node-sqlite3 by npm install sqlite3.

@elgs
Copy link

elgs commented Jul 11, 2013

As you mentioned your node version is 0.10.12, so I assume that this version was what you downloaded from the nodejs website, as opposed to getting from apt-get. If this is the case, you probably need to add node to you PATH. What I did was adding this line to the end of /etc/profile:
export PATH=/opt/node/bin:$PATH
where I put my node installation at /opt/node.

@elgs
Copy link

elgs commented Jul 11, 2013

@elgs - note that the error was:

Creating test database... This may take several minutes.
/bin/sh: 3: node: not found

@hightechlofi after you uninstalled the old node, try node --version to see the version of your node on the PATH. Hopefully it will be 0.10.12.

@springmeyer I'm afraid the reason of node: not found was that the new version of node was not on the PATH.

@manasmbellani
Copy link

I had this exact same problem when trying to install a custom software using nodejs on linux mint 14.1 virtual box in windows 7 host. sudo apt-get update did not provide the latest versions of nodejs. I uninstalled the old versions of nodejs and npm through sudo apt-get remove... and reinstalled the latest versions of nodejs by downloading the SOURCE VERSION of nodejs from the home page. It worked like a charm!

PS: Avoid compiling and performing "make" and "make install" for nodejs in shared folder in virtual box. Symbolic link creation is disabled inside shared folders in virtual box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants