libxmljs: scons command not found - node.js

When I was trying to deploy my node.js app (with both nodejitsu and heroku), I got the same errors with libxmljs.
> libxmljs#0.4.1 preinstall /root/tmp/tmp-31613c7bs0y8/build/package/node_modules/twilio/node_modules/libxmljs
> make node
make: scons: Command not found
make: *** [node] Error 127
npm http 200 https://registry.nodejitsu.com/css-stringify
npm http 200 https://registry.nodejitsu.com/css-parse
npm http 200 https://registry.nodejitsu.com/is-promise/-/is-promise-1.0.1.tgz
> libxmljs#0.4.1 preuninstall /root/tmp/tmp-31613c7bs0y8/build/package/node_modules/twilio/node_modules/libxmljs
> make clean
make: scons: Command not found
make: *** [clean] Error 127
npm http GET https://registry.nodejitsu.com/css-stringify/-/css-stringify-1.0.5.tgz
npm http GET https://registry.nodejitsu.com/css-parse/-/css-parse-1.0.4.tgz
npm WARN continuing anyway libxmljs#0.4.1 preuninstall: `make clean`
npm WARN continuing anyway Exit status 2
npm ERR! libxmljs#0.4.1 preinstall: `make node`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the libxmljs#0.4.1 preinstall script.
npm ERR! This is most likely a problem with the libxmljs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! make node
npm ERR! You can get their info via:
npm ERR! npm owner ls libxmljs
npm ERR! There is likely additional logging output above.
npm ERR! System SunOS 5.11
npm ERR! command "node" "/opt/local/bin/npm" "install" "--loglevel=http"
npm ERR! cwd /root/tmp/tmp-31613c7bs0y8/build/package
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.14
npm ERR! code ELIFECYCLE
As you can see, it is failing within libxmljs's 'make node' and 'make clean' as the command 'scons' is not found. I have libxmljs installed in my app's node_modules directory, and 'scons' is located at "/usr/local/bin/scons".
I believe I have to ensure that the location of scons is in the path for the make environment of libxmljs but I don't know how to do that. Any help would be appreciated!
UPDATE: Following the advice from this question (Fail to deploy node.js application to heroku) I added libxmljs to the dependencies in package.json and added node_modules/ to .gitignore, that way heroku could have a look at the dependencies and install them itself. However, the exact same error occurred, which leads me to believe the root of the problem is not with my local environment, but something larger regarding libxmljs?

I was able to resolve my problem, although it wasn't really specifically about libxmljs. I also used the 'twilio' node submodule in my app, but listed its version as '0.0.0' in dependencies. I guess twilio 0.0.0 used libxmljs which wouldn't install when deploying to heroku, so I updated the twilio version number to the actual current version, and everything's good to go!

Related

NextJS not running on MacOS even after installing modules

So I've just created a NextJS project using create-next-app which went smoothly as expected. Then ran npm i just to be sure and saw all modules installed into node_modules
When I try to run npm run dev to start my nextjs app. it just says
sh: next: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! test#0.1.0 dev: `next dev`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the test#0.1.0 dev 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! /Users/john.v.n.pakson/.npm/_logs/2022-10-06T08_01_29_725Z-debug.log
It seems like npm is not detecting the node_modules i have installed.
Not sure if this is a mac or a zsh issue.
I'm using node version 12.22.12
Upgraded to 16.17.1 and still see the same error
> test#0.1.0 dev
> next dev
/var/folders/6y/xtlzp4z16dj0stxnqx8znj8w0000gn/T/dev-01c08137.sh: line 1: next: command not found
Okay I figured it out. It was caused by my file path on macos. My project was on a folder called Project/Test which might have confused zsh or mac. This in turn caused npm to not be able to find the correct scripts on my node_modules
When I moved my project to another folder I was already able to run npm run dev properly.
Cheers!

Angular npm link throws 404 while linking local dependency lib

As the title says, creating a link with the dependency (it shows inside my global node folder). However I am using nvm-windows which creates separate folders fore each version which may cause some issues but reading about this issue the env var NVM_SYMLINKS used to fix this.
Env variables contains NVM_SYMLINKS and it points to a nodejs installation at my main drive which according to other issues is fine.
$ npm start
> own-webpage#0.0.0 start C:\PROJECTS\HMR\HKIR\hkir\hmr\bo\frontend
> npm link lib-hkir-common-client-bo && ng serve
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/lib-hkir-common-client-bo - Not found
npm ERR! 404
npm ERR! 404 'lib-hkir-common-client-bo#latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\WORKSTATION\AppData\Roaming\npm-cache\_logs\2022-03-28T09_39_51_833Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! own-webpage#0.0.0 start: `npm link lib-hkir-common-client-bo && ng serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the own-webpage#0.0.0 start 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! C:\Users\WORKSTATION\AppData\Roaming\npm-cache\_logs\2022-03-28T09_39_51_877Z-debug.log
Running node -v in both directories shows that both of them are using the same versions.
I've tried deleting both node_modules, package-locks, removing the smylink from the main global recreating said symlink. But nothing seems to work.
When creating the link via npm link inside the dependency it prints out the following symlink pattern:C:\Program Files\nodejs\node_modules\lib.hkir.common.client.bo -> C:\PROJECTS\HMR\HKIR\hkir\lib.hkir.common.client.bo which once again according to others is completely fine.
How can I fix the issue so my project sees and uses the linked dependency?
Thanks.

Cannot find module 'util.js' after command npm init on Windows 10

I installed npm before and work with many projects along with express.js , but today I opened a folder and willing to start a new project. But after npm init command , it says util.js module not found.
I found this util.js file on this root directory npm\node_modules\npm\node_modules.
How to solve this issue?
F:\Pulok\HabluTheGreatDoc\Projects\ReactApp\event-booking>npm init
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './util.js'
npm ERR! Require stack:
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\node_modules\libnpx\index.js
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\lib\init.js
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\lib\npm.js
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sabbir\AppData\Roaming\npm-cache\_logs\2020-07-12T06_33_44_670Z-debug.log
Edit:
npm version: 6.14.5.
node.js version: v12.16.1
I have also tried running npm cache clean --force and npm init --yes, however I continue to get the same error message.

npm install: 'bower install' exited with error code 1

I want to programm widgets for XBee ZigBee Cloud Kit.
To do it, I need first to set up everything.
I'm using this guide.
After failing repeatedly the automated setup I started the Manual setup. I did install the Requirements. So everything so far went good until the last point: npm install. I'm getting the following error bower install' exited with error code 1. I'm not sure what to do, I'm not used to PowerShell or any other shell.
After failing the installing I get this errors:
bower justgauge#* ECMDERR Failed to
execute "git ls-remote --tags --heads git://github.c
om/oscarcv/justgage.git", exit code of #128 fatal: remote error:
Repository not found.
Additional error details: fatal: remote error: Repository
not found.
'bower install' exited with error code 1
npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "i nstall"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! code ELIFECYCLE
npm ERR! xbee-zigbee-cloud-kit#1.0.0 postinstall: node postinstall.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xbee-zigbee-cloud-kit#1.0.0 postinstall script 'node postinstall.js'.
npm ERR! This is most likely a problem with the xbee-zigbee-cloud-kit package,
npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall.js npm ERR!
You can get their info via:
npm ERR! npm owner ls xbee-zigbee-cloud-kit
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\steim\Desktop\XBeeZigBeeCloudKit-master\npm-debug.log
"This is most likely a problem with the xbee-zigbee-cloud-kit package"
If this is true, in that case I don't know what to do, because I work with this package.
This is the npm-debug.log. (Sorry I can't post the whole log, too many characters).
I'm using a company laptop:
Latitude D820
Windows 7 32 Bit
Windows PowerShell with Administration
I'm grateful for any kind of help. I'm getting headache trying to figure it out.
I could solve it. And can now run the app now localy.
I did this steps to solve the issue:
Deleting justgage in bower.json file.
Using commandline: bower install justgage-official
Using commandline: bower update
The only problem is actually I can't start with foreman start (but it's another issue), instead I use python manage.py runserver 0.0.0.0:5000. After that in browser: http://localhost:5000
Thanks Etan Reisner for the hint and thanks Oscar Costoya for guiding me.

Error installing contextify- node-gyp rebuild failed

Edit
I upgraded node and ran "npm install -g contextify" It looks like it installed fine (no errors), but typing in "which contextify" returns nothing. Message while installing contextify:
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings
> contextify#0.1.6 install /usr/local/share/npm/lib/node_modules/contextify
> node-gyp rebuild
CXX(target) Release/obj.target/contextify/src/contextify.o
SOLINK_MODULE(target) Release/contextify.node
SOLINK_MODULE(target) Release/contextify.node: Finished
contextify#0.1.6 /usr/local/share/npm/lib/node_modules/contextify
└── bindings#1.1.1
Original
I'm having a problem installing contextify with npm:
npm install -g contextify
and get the following error messages:
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings
> contextify#0.1.6 install /usr/local/share/npm/lib/node_modules/contextify
> node-gyp rebuild
CXX(target) Release/obj.target/contextify/src/contextify.o
SOLINK_MODULE(target) Release/contextify.node
SOLINK_MODULE(target) Release/contextify.node: Finished
/usr/local/Cellar/node/0.10.1/lib/node_modules/npm/bin/node-gyp-bin/node-gyp: line 2: 73593 Segmentation fault: 11 node "`dirname "$0"`/../../node_modules/node-gyp/bin/node-gyp.js" "$#"
npm ERR! contextify#0.1.6 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 139
npm ERR!
npm ERR! Failed at the contextify#0.1.6 install script.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls contextify
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.0.0
npm ERR! command "/usr/local/Cellar/node/0.10.1/bin/node" "/usr/local/bin/npm" "install" "-g" "contextify"
npm ERR! cwd /Users/projects/
npm ERR! node -v v0.10.1
npm ERR! npm -v 1.2.15
npm ERR! code ELIFECYCLE
Anyone know what's going on here? I read that it may have something to do wit my PYTHON PATH, but I'm not sure how it should look.
Thanks for the help.
I had the same problem with node-gyp rebuild. The solution was install g++:
apt-get -y install g++
Original problem
Segmentation fault: 11 node "dirname "$0"
This appears to be a bug in V8 exposed by compiling with Clang. It's been fixed in more recent versions of Node, so you'll need to update. The github issue is tracked here
Edit problem
There is no contextify command-line program that you can run, so which contextify has nothing to find. The contextify module is meant to be used within node by using require('contextify') to load the module.
Based on how you've described this, it seems like you may be conflating two things. Modules installed with npm install -g are installed globally and accessible to all node applications, but that does not mean that they will expose a script that can be executed on the command line. -g only controls the installation path of the module.
Whether a module has a command-line script you can run depends on whether the module's package.json defines a set of bin commands, e.g. jshint. When you install with -g, the scripts listed are symlinked along with node so they are accessible via your PATH. When installed without -g, bin scripts are installed into node_modules/.bin and you would have to add that directory to your PATH for scripts to work.
There is no such thing as contextify binary. There is contextify.node binary in /usr/lib/node_modules/contextify/build/Release/ (when installed globally in my ubuntu 12.04).
Just use the module in your node program by using require('contextify') and it should work.
var Contextify = require('contextify');
var sandbox = Contextify(); // returns an empty contextified object.
sandbox.run('var x = 3;');
console.log(sandbox.x); // prints 3
sandbox.dispose();

Resources