building modernizr on the windows command line - javascript

So I followed the docs here:
https://github.com/modernizr/modernizr
1) cloned the repo using npm.
2) ran npm install inside modernizr to install its dependencies.
3) tried to run ./bin/modernizr -c lib/config-all.json
I am getting an error:
'.' is not recognized as an internal or external command
I am assuming that this has to do with the windows command line not understanding that I am trying to execute the file at that location. How can I do step 3 on cmd?
Thanks in advance.

Here we go. You need to run the modernizr bin from within node.
node .\bin\modernizr -c .\lib\config-all.json

Run the instructions in PowerShell. It does a better job of support *nix-style syntax and commands than the Command Prompt.

Use Git Bash (part of Git for Windows) or (iof you feel like going in the front door) Minimalist GNU For Windows (http://www.mingw.org/) It works fine.

Related

How to Run JavaScript file with node.js on windows (scribbletune)

Is it possible to run a JavaScript file with node.js on windows? I have been trying to for hours and can't find any more solutions on the internet that work.
I have a js-file that uses scribbletune which only works with node.js.
I have node.js installed and I installed gitbash because it was recommended in a forum.
I tried to run from command prompt and gitbash but nothing seems to happen.
What am I doing wrong? Any help would be very much appreciated.
There is no need to install gitbash to use Node on Windows. It's a handy thing to have if you're used to a *nix environment. If you're not, it just gives you something more to learn, which isn't helpful if you're already in the middle of trying to learn Node.
Just:
Get the Windows installer from https://nodejs.org/en/download/
Run the Windows installer
Create a directory for your project
Open a Command Prompt Window to get a command line
Switch to your project directory
(Optional, but a good idea) Use npm init to create a package.json file (it'll walk you through it)
Install any libs you're going to be using via npm (for instance, npm install scribbletune from your command prompt window)
Put your JavaScript files in that directory
Use node main.js at the command line to run your main file (whatever it's called; main.js is just a placeholder)
Inorder to run a js (java script file) file
step 1. u need to go to the file location where u want to run.
step 2. just use "shift +right click".
u will see a pop-up and go to powershell or cmd.
step 3. type "node FILENAME.js"
final step: you will see the result ^.^

JavaScript Program Path Not Specified Error

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

npm not installing returns error consistently

I was trying to install this : Search git whodotheyserve. com but this error shows up consistently .No matter what i try. I have tried other version of npm they are installed but the
npm test
error shows up .
npm run-script task
too returns error
This happens consistently .Also i am following each step mentioned in source of this project.Image attached.Please help where am i wrong here. The file extension used here ls .I had no experience with these. Image link
Echo %PATH% image link
The build fails because you are using Windows instead of Linux.
This is clearly stated in the installation instructions you claim to have followed in your duplicate question.
notes
The build tasks rely on Linux shell commands such as pkill and rsync
so are unlikely to run on other OS's without some tweaks.
If you want to run this under windows, you should ask the repo maintainer for guidance.
You have to install python 2.7 and make sure it's in your PATH variable.
Try:
set PATH=%PATH%;C:\python2.7\python.exe
Replace C:\python2.7\python.exe with your actual python installation path
The issue here was that this was made to run on linux only.So ,it won't run on windows on which i was trying to run it.The issue arose as i was trying to install it on wrong OS.I have successfully installed it on linux.It works great.
I want to thank all those who contributed in helping me with this issue.Thanks a lot to all those who helped.

Uncaught Error: Module did not self-register

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"**

Rails - Could not find a JavaScript runtime?

I created a new Rails project using rails 3.1.0.rc4 on my local machine but when I try to start the server I get:
Could not find a JavaScript runtime. See here for a list of available runtimes. (ExecJS::RuntimeUnavailable)
Note: This is not about Heroku.
Installing a javascript runtime library such as nodejs solves this
To install nodejs on ubuntu, you can type the following command in the terminal:
sudo apt-get install nodejs
To install nodejs on systems using yum, type the following in the terminal:
yum -y install nodejs
Note from Michael 12/28/2011 - I have changed my accept from this (rubytheracer) to above (nodejs) as therubyracer has code size issues. Heroku now strongly discourage it. It will 'work' but may have size/performance issues.
If you add a runtime, such as therubyracer to your Gemfile and run bundle then try and start the server it should work.
gem 'therubyracer'
A javascript runtime is required for compiling coffeescript and also for uglifier.
Update, 12/12/2011: Some folks found issues with rubytheracer (I think it was mostly code size). They found execjs (or nodejs) worked just as well (if not better) and were much smaller.
n.b. Coffeescript became a standard for 3.1+
Add following gems in your gem file
gem 'therubyracer'
gem 'execjs'
and run
bundle install
OR
Install Node.js to fix it permanently for all projects.
sudo apt-get install nodejs does not work for me. In order to get it to work, I have to do the following:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
Hope this will help someone having the same problem as me.
On the windows platform, I met that problem too
The solution for me is just add
C:\Windows\System32
to the PATH
and restart the computer.
I had this issue on a Windows machine and installing node.js was the solution that finally worked for me. This came after trying multiple other routes including trying to get 'therubyracer' working. Though the github for node.js suggests that installation on windows is still unstable, the website at http://nodejs.org/ had a Windows installer which worked perfectly.
if you already install nodejs from source for example, and execjs isn't recognizing it you might want to try this tip: https://coderwall.com/p/hyjdlw
If all fails you can try
# aptitude install nodejs
as root. You can test your install with the following command:
# node -v
If you want to install NPM, please refer following link. Hope it helps.
On CentOS 6.5, the following worked for me:
sudo yum install -y nodejs
Install a Javascript runtime
The error is caused by the absence of a Javascript runtime on your local machine. To resolve this, you'll need to install NodeJS.
You can install NodeJS through the Node Version Manager or nvm:
First, install nvm:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
Install Node through nvm:
nvm install 5.9.1
This will install version 5.9.1 of Node.
I ran into this issue using Phusion Passenger (running as an nginx module) on a Redhat server. We already had a Javascript runtime installed. Other Rails apps in the same parent directory worked fine.
It turned out that we had a permissions issue. Run "ls -l" and see if the folder has the same owner and group as other working apps on the system. I had to run chown and chgrp on the folder (with the recursive switch) to fix it.
I hope you have pre-installed nodejs || nmv.
My solution does not require gem setup or installing 'node with sudo apt" when you already have nvm.
All you need is to edit DesctopEntry of RubyMine. for that we will have those small steps:
Go to usr/share/applications
Open in any editor (i use vim ) Rubymine DesktopEntry vim RubyMine
Edit line 6 (starts with Exec). You shoud add to beginning /bin/bash -i -c. So your line should look like this
Exec=/bin/bash -i -c "/home/USERNAME/rubymine/RubyMine-2019.1.2/bin/rubymine.sh" %f
Done! You are glorious!
As a benefit all your environment variables are now available for RubyMine. So you feel no pain with additing them.
On MacOS try running:
brew install node
brew link node
To force the link and overwrite all conflicting files:
brew link --overwrite node
node -v

Categories