I am unable to resolve this error. I don't even know what's causing it. I have the latest version of npm and the most stable version of node.
$ nvm use 0.10.40
/Users/Test/.nvm/v0.10.40/lib/node_modules/npm/lib/utils/unsupported.js:27
console.error(`a bug known to break npm. Please update to at least ${r
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /Users/Test/.nvm/v0.10.40/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object.<anonymous> (/Users/Test/.nvm/v0.10.40/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run npm config delete prefix or nvm use --delete-prefix v0.10.40 to unset it.
I tried to run nvm use --delete-prefix v0.10.40 but that gives me the same error as well.
You probably need up update Node.js which you can do by visiting
https://nodejs.org/en/
See:
https://github.com/npm/npm/issues/18963
Update your nodejs version, install the nvm https://github.com/creationix/nvm.
Later install the version choice of nodejs
# e.g, replace for a current version
nvm install 9.3.0
Related
I have an Ubuntu box with node - v 9.5.0 and npm - 5.6.0 versions. I am trying to use expressjs (http://expressjs.com), but unable to run it. It works fine for node v 4.x.x.
$ express -h
module.js:557
throw err;
^
Error: Cannot find module 'commander'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/lib/nodejs/express-generator/bin/express:3:15)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
What is it that I am missing here?
Ubuntu's packages seem to be outdated.
Installing using apt-get node-express-generator gives this error.
Installing using npm i -g express-generator works fine.
Please try to follow the preceding steps.
Install the current version of NodeJS
Uninstall all modules with npm uninstall and rm -fr ~/.npm
Reinstall express-generator
Hope it helps.
after i install the nodejs and npm , gitbook-cli ,there is an error.like this:
[root#vagrant-centos65 vagrant]# gitbook -v
/usr/lib/node_modules/gitbook-cli/node_modules/fs-extra/lib/index.js:3
const assign = require('./util/assign')
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/node_modules/gitbook-cli/lib/config.js:2:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
[root#vagrant-centos65 vagrant]# npm -v
1.3.6
[root#vagrant-centos65 vagrant]# node -v
v0.10.48
my nodejs version and npm are v0.10.48 ,1.3.6 ,what should i do ,please help me .
As this answer explain, const support is not enabled by default in node.js version 0.10 and require --harmony flag if you want to use it.
As this version of fs-extra package use const keyword in his index.js file, you got this error.
You can have a look at this compatibility table for a summary for const and let support by version.
Just upgrade your node.js version to solve this issue.
Also, I don't think it is a good idea to launch gitbook as root user.
thanks # TGrif , i upgrade my nodejs ,and its worked.
npm cache clean -f
npm install -g n
n stable
ln -sf /usr/local/n/versions/node/8.0.0/bin/node /usr/bin/node
How do I update Node.js?
I was using npm few days ago and all worked fine, but I'm suddenly getting an error when trying to do any npm command.
module.js:487
throw err;
^
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/tracker-stream.js:3:14)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
I can't do any npm command, even npm -v show this error, node version is 8.0.0
I'm using latest version of macOS
One of the problems is that I didn't install node using homebrow so uninstalling and installing it again is the last solution for me.
Any help with this?
When on a Mac, use nvm to install node, and switch node versions.
Also can nicely reinstall packages when upgrading versions. nvm install 6 --reinstall-packages-from=5
This is better than homebrew, which I would not suggest for Node on a Mac.
After upgrading the nodejs version running on my Openshift's gear from v0.10 to v0.12, I get the following error:
Error: /app-root/runtime/repo/node_modules/bcrypt/build/Release/bcrypt_lib.node: undefined
symbol: node_module_register
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at bindings (/app-root/runtime/repo/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/app-root/runtime/repo/node_modules/bcrypt/bcrypt.js:3:35)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
The bcrypt version in my package.json is set to ~0.8.5.
So far I have tried these without success:
- rhc ssh myapp then update node-gyp, rm -rf node_modules and npm install;
- manually installed the dependencies;
- edited package.json to preinstall node-gyp
"scripts":{
"preinstall": "npm i -g node-gyp && node-gyp clean"
}
anyone has an idea / knows on how I can solve this? (ideally the solution won't require to upgrade gcc)
Also, I am using Ryan J's custom cartridge for nodejs v.012
I finally solved it with a workaround by editing .openshift\lib\utils and adding export OPENSHIFT_NODEJS_VERSION=0.6 in the setup_path_for_custom_node_version() function:
# Add the node binary path to the PATH.
export OPENSHIFT_NODEJS_VERSION=0.6
export PATH="$node_bin_path:${PATH}"
after updating NodeJS to v0.10.29 I got the following error:
Error: Module version mismatch. Expected 11, got 1.
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at bindings (/home/masiar/usi_liquid_streams/node_modules/jsdom/node_modules/contextify/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/home/masiar/usi_liquid_streams/node_modules/jsdom/node_modules/contextify/lib/contextify.js:1:96)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
Executing sudo npm update did not work. I installed back version v0.10.15 (was using that one before), ran sudo npm update and uninstalled and installed back jsdom gave the same error.
This problem is usually happened when upgrading node version. You are in this scenario: you are using Node for example version 5. You add some libraries inside your project, build and run that. All your libraries will be compiled under node version 5.
And then you upgrade your node for example to version 6. And then you run some commands that using node, for example npm run test. The problem is here: you use newer node version for running libraries that compiled by older node.
Solving this is easy by 2 following commands:
rm -rf node_modules // force remove node_modules directory
npm install // install again all libraries. Libraries will be compiled again with new node version
Hope this help :)