I try to use node-vlc with nw.js (v0.12.0-alpha2). When i launch my app without nw.js it works, but when i launch it with nw.js i got an error:
Uncaught Error: Module did not self-register.", source: /home/alexis/Bureau/dev/jukebox/node_modules/vlc/node_modules/ffi/node_modules/bindings/bindings.js (84)
I tried some commands with nw-gyp but it couldn't help me.
I am on Ubuntu 14, 64-bit.
If you've upgraded node then npm rebuild might fix this for you
For me:
rm -r node_modules then
npm install
I had a similar issue with another product and my fix was to change the version of node I was using. I was using 0.12.0 and changed back to 0.10.26.
Personally, I use NVM to handle node version changing. With NVM installed it's as simple as running
nvm use 0.10.26
Or setting the default version to 0.10.26
nvm alias default 0.10.26
Hopefully this helps you out - our issues came from different products but the solution may be the same.
I had similar problem.
/Users/user/NodeAddons/bridge/node_modules/bindings/bindings.js:83
Error: Module did not self-register.
In my case I was doing a C/C++ Add-on, and I had forgotten to export the add-on, in my main.cc was missing the code below:
void Init(v8::Handle<v8::Object> exports) {
NODE_SET_METHOD(exports, "method", method);
}
NODE_MODULE(method, Init);
Hope this helps others!
Thanks :)
I've add the same issue because I installed to modules as sudo...
Removing the node modules folder and reinstalling as normal user fixed it.
For me npm rebuild or npm update didn't work. I had to remove the node_modules folder and run npm install to install them again.
I once had this problem when creating a multi-file c++ addon. In my binding.gyp file I had:
"sources": ["src/*.cc", "src/*.h" ]
And my project contained several *.cc files. However, the NODE_MODULE() macro was called only on one file which imported the rest of the files. But node expects that it is called on the frist *.cc file listed in sources. So I had to change sources to explicitly add that file to the beginning
For me, running npm update worked
I was getting an internal error: Module did not self-register.
Deleted the node_modules folder
ran npm install
It worked just fine.
I had this error with Snappy. Was using Node 11. Checked Snappy's NPM page https://www.npmjs.com/package/snappy where they listed which versions of node they supported.
Deleting node_modules folder rm -rf node_modules and then reinstalling using the correct version of Node resolved it.
One of the versions they supported on Linux at the time of this writing was Node version 12.
nvm deactivate 11
nvm uninstall 11
nvm install 12
nvm use 12
Problem solved
Another cause of this problem: if you're using pm2, then after upgrading node you may need to reinstall pm2. Test whether pm2 is the issue by running your app
without pm2 node server.js
then with pm2: pm2 start server.js.
Proper way to update PM2 after updating Node.js
I had this same issue with 0.12 and io.js 1.3.0, reverting to Node.js 0.10 fixed the issue.
Rebuild your C++ add-ons.
Did you encounter something like this?
Module did not self-register: '…\node_modules\#u4\opencv4nodejs\build\Release\opencv4nodejs.node
It’s likely that you have just updated your Node.js. Once you updated your Node.js, you need to rebuild your C++ add-ons, Node.js packages written in C++.
Why
When you build Node.js’ C++ add-ons, they get compiled into require-able .node files and linked to the currently installed Node.js ABI library, which is not compatible with other versions of it. Your packages were built only compatible with the specific version of Node.js.
How
Firstly, try npm rebuild. If your C++-add-on-based packages have a build script, it’ll do. If it doesn’t, you need to manually build your C++ native add-on packages. Do again what you did when you were installing such packages. Refer to the building instructions in the packages’ documentations to rebuild them. Or try reinstalling (npm install) them.
I had the same problem. My script that was referencing a global reference script had an invalid reference. I took off that invalid reference and the error was gone. My error message had no indication of that particular invalid reference which made it harder to debug. But 'Uncaught Error: Module did not self-register' was the message I was getting.
This also happen in my other project. For some reason, it wouldn't recognize the reference path if one of the characters are uppercase. Even thought, the upper-casing was the correct spelling of the path.
I had this issue while setting up my Cypress project.
I found out the issue was caused because Cypress uses node from its bundle version by default (which was version 8.0 in my case) , whilst the package I wanted to use required the node version to be 10 or higher.
I did have node 12.0 installed on my machine but since cypress was not using that I had to add the line shown below in the settings file (cypress.json) to set the value for 'nodeVersion' to 'system', to tell cypress explicitly to use the node version installed on my machine.
Add this line to your settings file:
**"nodeVersion": "system"**
Related
I am new to coding and would appreciate some help with this I get the following error when I try to run my react app: npm run start
Failed to compile.
Loading PostCSS "postcss-normalize" plugin failed: Cannot find module 'postcss-normalize'
Require stack:
/Users/abc/node_modules/postcss-loader/dist/utils.js
/Users/abc/node_modules/postcss-loader/dist/index.js
/Users/abc/node_modules/postcss-loader/dist/cjs.js
/Users/abc/node_modules/loader-runner/lib/loadLoader.js
/Users/abc/node_modules/loader-runner/lib/LoaderRunner.js
/Users/abc/node_modules/webpack/lib/NormalModule.js
/Users/abc/node_modules/webpack-manifest-plugin/dist/index.js
/Users/abc/node_modules/react-scripts/config/webpack.config.js
/Users/abc/node_modules/react-scripts/scripts/start.js
(#/Users/abc/node_modules/bootstrap/dist/css/bootstrap.css)
ERROR in ./node_modules/bootstrap/dist/css/bootstrap.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/bootstrap/dist/css/bootstrap.css)
./node_modules/bootstrap/dist/css/bootstrap.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/bootstrap/dist/css/bootstrap.css)
Module Error (from ./node_modules/postcss-loader/dist/cjs.js):
Loading PostCSS "postcss-normalize" plugin failed: Cannot find module 'postcss-normalize'
Require stack:
/Users/abc/node_modules/postcss-loader/dist/utils.js
/Users/abc/node_modules/postcss-loader/dist/index.js
/Users/abc/node_modules/postcss-loader/dist/cjs.js
/Users/abc/node_modules/loader-runner/lib/loadLoader.js
/Users/abc/node_modules/loader-runner/lib/LoaderRunner.js
/Users/abc/node_modules/webpack/lib/NormalModule.js
/Users/abc/node_modules/webpack-manifest-plugin/dist/index.js
/Users/abc/node_modules/react-scripts/config/webpack.config.js
/Users/abc/node_modules/react-scripts/scripts/start.js
(#/Users/abc/node_modules/bootstrap/dist/css/bootstrap.css)
Thank you so much
I've tried updating to the latest version of node and npm, however, that did not help. I've also verified my code several times as I'm mostly practicing along with a course. Thank you.
As it appears this error will temporarily get fixed by installing the latest version of Node.js.
So to fix this follow these steps:
Download and install the latest Node.js version (recommended for most users, which is 16.15.0 at this moment).
Delete your node_modules directory from your project. Then you can optionally clear npm cache with npm cache clean and verify it with npm cache verify.
Delete package-lock.json/yarn.lock file.
Reinstall all of the dependencies and create a new dependency tree using one of the following commands: npm i/npm install/yarn/yarn install.
Note1: If in any case, you use node-sass in React projects yet, it is recommended to use sass instead.
Note2: In some cases skipping step 1 will also work as expected, but I recommend upgrading the Node.js version if you do not have other dependencies to prevent that.
Note3: As #IvaniltonBezerra mentions in the comments, some app builds may throw errors, since upgrading Node.js to its latest version will upgrade the npm as well it may not compatible with your current dependency tree in production, so to prevent such a problem you have to use --legacy-peer-deps to restore the old behaviour of the old dependencies.
Update
This is now seem to be permanently solved in PostCSS Preset Env and following the above steps with skipping step 1 will also solve the problem.
I've been creating a JavaScript game for a project recently and have done it completely on the CodePen website. I now am trying to transfer it to WebStorm to turn it into a basic website. However when I try to run my code I get the following error:
I don't know how to fix it, I've looked everywhere and haven't been able to get some help. Any information would be appreciated.
Simple one, basically the error says, I don't know how to interpret this bit of code that you just gave me. You're missing local install of Node.js and NPM. Get the latest versions of these 2, and then go to File -> Settings -> Language&Frameworks -> Node.js and NPM and in the Node interpreter text box, point it to the path of where node.js was installed.
You're running this JavaScript file with Node.js that is probably not installed on your machine. It seems that you want to run and debug your app in the browser instead. For that you need to create a JavaScript run/debug configuration instead as described here: https://www.jetbrains.com/help/webstorm/debugging-javascript-in-chrome.html
On a linux machnie,
Install nodejs and npm
sudo apt-get install nodejs
sudo apt-get install npm
Get the nodejs installation folder
whereis nodejs
Should print something like:
/usr/bin/nodejs /usr/lib/nodejs /usr/include/nodejs /usr/share/nodejs /usr/share/man/man1/nodejs.1.gz
Go to:
Webstorm-> File -> Languages & Frameworks -> Node interpreter
Copy paste the installation folder to the text box.
Mac OS here. Solved the issue with:
$ brew install nodejs
I'm trying to simply install a stupid package in Node. I use the normal ol' command and it proceeds to tell me it can't find a file or directory (see image below). I've already updated and reinstalled npm, and still the same thing. I'm also running Windows 8. Any ideas, please?
Should I give up developing Node on a Windows machine?
Thanks!
Run npm init first and it will create the package.json file that it is looking for.
When running the test build, everything works find but when I try to build the distribution, I get the following error:
Cannot find module '/Users/matt.sich/Documents/angularProjects/firstProject/node_modules/grunt-usemin/lib/config/uglifyjs' Use --force to continue.
I checked that folder and the module is there. I have it installed in npm.
I tried removing the npm modules directory and reinstalling with npm install. This didn't solve the issue.
The issue was with the package.json and having ^s in front of the versions. The ^ updates to new minor versions of the dependencies. It's better practice to not use ^s and instead use the actual version you want to use and manually update the versions when needed.
Here's a way to migrate from ^s to version numbers: https://www.npmjs.com/package/npm-check-updates
After reading many ( if not all :-| ) posts having similar problems, I still don't have a working local (or a "global") install of node.js's Mac OSX system tools. Showing global attempt here...
Their doc implies either an npm install or a build from source - but not npm THEN source. However, a test run seems to be requiring compiled file(s) that don't exist after the attempted install.
Details:
It's my understanding that npm should be sufficient, but when I do the recommended
sudo npm install -g osx
npm creates /usr/local/lib/node_modules and populates with
README.md osx.cc osx.js package.json wscript
Running (from anywhere) node theirSample.js, containing:
Var osx = require('osx');
// also tried full path as recommended in other answers
var osx = require('/usr/local/lib/node_modules/osx');
The error is the commonly seen "cannot find module". However, the specific error is:
Cannot find module './build/Release/osx'
Which stems from the above osx.js created in /usr/local/lib/node_modules
That file has the errant line:
var osx = require('./build/Release/osx');
That implies that I need the ./build/Release/osx dir, but npm did not create this under the modules dir. So does that mean I need to compile the source? If so, any pointers on set up please.
First of all, you don't need to install it globally, and second, this module is already 2 years old, and it was tested on Darwin 11.2.
It does not work with OS X "Mavericks" - just tested on my machine.
As a replacement, I would recommend to take a look at os build-in module, which provides basic operating-system related utility functions, and is OS-agnostic