I have installed node.js v0.8.8 both from the pkg installer and compiled from source. Yet I get the following error when trying to run npm. Any help would be appreciated.
> $ npm --help
>
> /usr/lib/node_modules/npm/lib/utils/config-defs.js:5 , stdio =
> process.binding("stdio")
> ^ Error: No such module
> at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/config-defs.js:5:21)
> at Module._compile (module.js:449:26)
> at Object.Module._extensions..js (module.js:467:10)
> at Module.load (module.js:356:32)
> at Function.Module._load (module.js:312:12)
> at Module.require (module.js:362:17)
> at require (module.js:378:17)
> at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/ini.js:43:18)
> at Module._compile (module.js:449:26)
> at Object.Module._extensions..js (module.js:467:10)
I had the exact same issue upgrading from Node.JS 0.4 to 0.8. What worked for me was the following:
The OSX Node.JS package installer erroneously does not remove the old 0.4 npm installation in /usr/bin, which then conflicts with the new 0.8 one in /usr/local/bin. It just overwrites whatever is there already. I nuked the old one by deleting it, but to make sure, I decided a clean install would be better:
curl https://npmjs.org/install.sh | sudo clean=yes sh
There was one last problem: after the install, even though a which npm correctly returns /usr/local/bin/npm, bash kept trying to execute from /usr/bin. This is because on OSX, bash has hashed the executable name. The hashing saves repeated searches of all directories in your PATH every time you execute common programs. A hash -r at the command line took care of this issue.
You are most likely using an old NPM version somehow.
see: npm issue
Related
I have tried to create a project using
$ vue init webpack test
and got following error
/usr/local/lib/node_modules/vue-cli/bin/vue-init:60 let template =
program.args[0]
^ SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode at
exports.runInThisContext (vm.js:53:16) at Module._compile
(module.js:374:25) at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32) at Function.Module._load
(module.js:301:12) at Function.Module.runMain (module.js:442:10) at
startup (node.js:136:18) at node.js:966:3
Unfortunatly, "test" directory is not created.
I am using Bash on Ubuntu on Windows 10 and the following NPM packages:
vue#2.5.2
vue-cli#2.9.1
node.js#0.0.0
npm 3.5.2
Perhaps node verison is too low.
update your node version using
npm install -g n
sudo n stable
sudo npm install npm -g
when you node -v find there is no change, but try to init vue project again.
I am new to gulp but on a existing laravel project I needed to add some css I was told to update the app.sass and then run gulp to compile it. I tried to follow a guide called Compiling Assets (Laravel Elixir) to compile the sass file but ran into problems. To get everything installed correctly I updated our bootstrap.sh file in the vagrant setup to include nodejs, npm, gulp and laravel-elixir. Once the changes were made I loaded the vagrant box and I verified that I have the following versions.
[vagrant#localhost project-css]$ gulp -v
[18:12:38] CLI version 1.4.0
[18:12:38] Local version 3.9.1
[vagrant#localhost project-css]$ npm -v
3.10.10
[vagrant#localhost project-css]$ node -v
v6.11.1
When I try to run gulp I get
/vagrant/src/project-css/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:349
if (n <= 0 || state.length === 0 && state.end
SyntaxError: Invalid or unexpected token
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/vagrant/src/project-css/node_modules/through2/node_modules/readable-stream/readable.js:12:30)
The full project I'm working on is available on github at Rockefeller-css
Any suggestions would be appreciated.
I was able to resolve the issue on my own by adding the following to my bootstrap.sh file
rpm -ivh https://kojipkgs.fedoraproject.org//packages/http-parser/2.7.1/3.el7/x86_64/http-parser-2.7.1-3.el7.x86_64.rpm
yum install -y nodejs
Also after vagrant was finished loading and I was able to ssh into the box in a custom setup-vagrant.sh script that needed to be ran I was able to add the following command.
sudo npm install
Their was already a cd into the laravel project folder and their was a package.json file that existed. After that I was able to cd into the project folder and run gulp correctly.
Trying to get code running from my groups repo.... everyone elses seems to install and run fine, but my setup is having issues. Not sure if this is a dependency issue or not.
Tried removing node / npm / nvm and reinstalling everything including code from repo. Still having issues...
React : 0.14.8
react-native-cli: 0.2.0
react-native: 0.24.0
also react-native-cli was installed globally
with npm install -g react-native-cli
command after install : react-native run-ios
getting
/node_modules/react-native/Libraries/react-native/react-native.js:121
...require('React'),
^^^
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Module._extensions..js (module.js:442:10)
at Object.require.extensions.(anonymous function) as .js
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at
node_modules/react-native/node_modules/babel-core/lib/transformation/file/options/option-manager.js:409:22
at Array.map (native)
In npm#3 subDependencies are installed at the same level of your project dependencies (./node_modules). My guess is the project is missing some dependencies to run the packager. If you haven't already done so, updgrade to npm#3 ($ npm install -g npm), delete your node_modules folder, then try again.
$ rm -rf node_modules && npm install
My question is very similar to How do I resolve "Cannot find module" error using Node.js? but I cannot solve my problem using the information provided in the answer given.
I try to run the UNCSS grunt plugin, but when I try to install it (npm install grunt-uncss --save-dev), I get the following error:
$ npm install grunt-uncss --save-dev
module.js:340
throw err;
^
Error: Cannot find module 'abbrev'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/Cellar/node/0.10.20/lib/node_modules/npm/node_modules/nopt/lib/nopt.js:10:14)
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)
at Module.require (module.js:364:17)
Based on the answer mentioned above, I tried installing this 'abbrev' module, both in project folder, and globally, but this yields the exact same error :(
npm install -g abbrev
module.js:340
throw err;
^
Error: Cannot find module 'abbrev'
at Function.Module._resolveFilename (modu
(ETCETERA)
Main question: How to I solve this error?
Sub questions:
1) I wonder, is this a RUBY error or a NODE.JS error? I noticed 'abbrev' is also a Ruby command...?
2) Or, could this problem have arisen because I tried to solve the bus error: 10 ? (http://shoogledesigns.com/blog/blog/2014/01/13/gruntjs-running-watch-task-waiting-bus-error-10/)
I hope this question doesn't sound too obvious. I'm a front-end developer, but far from a command-line guru!
For me it has been solved by updating npm itself:
sudo npm install -g npm
Solution: re-installing node.js, as I mention in my last comment.
Tell-tale was the very same error-message every time I ran NPM.
Removing node_modules and then reinstalling the modules specified in my package.json worked for me.
I did that by runnning the following commands:
rm -rf node_modules
npm install
Neither one of the other two answers solved it for me, but both together did.
I had a very similar issue. Removing the entire node_modules folder and re-installing it's worked for me. I did that by running the following commands:
rm -rf node_modules
npm install
Windows user here. I tried re-installing Node.js (using installer) and it did not help. I had to run the rm -rf node_modules to remove the "node_modules" folder at the location listed in the error (midway down).
In the OP example it was at
Object. (/usr/local/Cellar/node/0.10.20/lib/node_modules/
It was something like C:\Users\nick\AppData\Roaming\npm\node_modules
Hi I am trying to install zmq module on a linux machine.Below are the steps that i followed
• Make sure you have the following packages installed (sudo apt-get install binutils libtool autoconf automake)
• Get the latest POSIX tarball (http://zeromq.org/intro:get-the-software) and untar it
• Run configure (./configure)
• Run make (sudo make install)
• npm install zmq or npm update if you already have it listed in your package.json
• sudo ldconfig (otherwise you might get the error "connot open shared object file")
But when i ran the above steps i got the error as below
Error: libzmq.so.3: cannot open shared object file: No such file or directory
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> (/var/MLIDeployment/MLI/zeromq-4.0.3/node_modules/zmq/lib/index.js:8:11)
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)
at Module.require (module.js:364:17)
I'm stuck here any help regarding this will be much helpful
The error you are getting is that libzmq.so cannot not found.
You need to add the install directory (defaults to /usr/local/lib) to LD_PATH.
To add it you need to execute:
sudo echo "/usr/local/lib" >> /etc/ld.so.conf.d/local-lib.conf
sudo ldconfig
Hope this works.