Issue in starting Node App on Windows 7 - windows

I am using windows 7 and I have installed node.js and express.
After I create a project using express using the command below
> express projectName
A new project is created and after that to install dependencies I do
> npm install
All works good so far. but when I try to start the application
> npm start
Below is the issue I get in the npm-debug.log file. Please suggest whats wrong here. I have tried many other threads but solution found there work for me.
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#1.4.28
3 info using node#v0.10.33
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart NodeTestApp#0.0.0
7 info start NodeTestApp#0.0.0
8 verbose unsafe-perm in lifecycle true
9 info NodeTestApp#0.0.0 Failed to exec start script
10 error NodeTestApp#0.0.0 start: `node ./bin/www`
10 error spawn ENOENT
11 error Failed at the NodeTestApp#0.0.0 start script.
11 error This is most likely a problem with the NodeTestApp package,
11 error not with npm itself.
11 error Tell the author that this fails on your system:
11 error node ./bin/www
11 error You can get their info via:
11 error npm owner ls NodeTestApp
11 error There is likely additional logging output above.
12 error System Windows_NT 6.1.7601
13 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error cwd C:\Users\Ali\Desktop\NodeTestApp
15 error node -v v0.10.33
16 error npm -v 1.4.28
17 error syscall spawn
18 error code ELIFECYCLE
19 error errno ENOENT
20 verbose exit [ 1, true ]

child_process.spawn() returns ENOENT when it can't find the requested executable; in this case, node.exe. Looking closely at the log, we can see that npm start is attempting to run node app.js.
Is node on your PATH? What happens if you just type node app.js on the command line?

Try this.It's working for me on Windows 7 32 bit node.js
Create new blank folder for your project.Go to your project folder and create manually npm folder (don't use command line).
Then try again create new project.
Hope this help.

Related

how to run Node-Red in docker using windows

I use this command in windows
I actually don't know where node_red_data is.
docker run -it -p 1882:1880 -v node_red_data:/data nodered/node-red
and I got following error.
npm ERR! code EJSONPARSE
npm ERR! file /usr/src/node-red/package.json
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected end of JSON input while parsing near ''
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
npm ERR! A complete log of this run can be found in:
npm ERR! /data/.npm/_logs/2021-01-26T11_44_30_912Z-debug.log
this is also my log file
this file is created automatically inside my node_red_data folder
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli '--no-update-notifier',
1 verbose cli '--no-fund',
1 verbose cli 'start',
1 verbose cli '--cache',
1 verbose cli '/data/.npm',
1 verbose cli '--',
1 verbose cli '--userDir',
1 verbose cli '/data' ]
2 info using npm#6.14.10
3 info using node#v10.23.1
4 verbose config Skipping project config: /usr/src/node-red/.npmrc. (matches userconfig)
5 verbose stack Error: Failed to parse json
5 verbose stack Unexpected end of JSON input while parsing near ''
5 verbose stack at parseError (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:470:11)
5 verbose stack at parseJson (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:105:26)
5 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:52:5
5 verbose stack at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:123:16
5 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
6 verbose cwd /usr/src/node-red
7 verbose Linux 4.19.128-microsoft-standard
8 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "--no-update-notifier" "--no-fund" "start" "--cache" "/data/.npm" "--" "--userDir" "/data"
9 verbose node v10.23.1
10 verbose npm v6.14.10
11 error code EJSONPARSE
12 error file /usr/src/node-red/package.json
13 error JSON.parse Failed to parse json
13 error JSON.parse Unexpected end of JSON input while parsing near ''
14 error JSON.parse Failed to parse package.json data.
14 error JSON.parse package.json must be actual JSON, not just JavaScript.
15 verbose exit [ 1, true ]
any help?
Hey the issue you are facing originates in mounting the volume (-v ...) you need to pass a valid Windows Path as an argument. For more information: Official Docker documentation
Command to run Node-RED as a Docker container: docker run -p 1880:1880 -it -v "<Path-on-your-Windows-OS>:/data" nodered/node-red
Where <Path-on-your-Windows-OS> e.g. C:\Users\<username>\Documents\node-red-docker
I just made my own node-red instance. I couldn't work with node-red image.
FROM node
WORKDIR /usr/src/node-red
RUN npm install -g --unsafe-perm node-red
CMD node-red

Received Z_BUF_ERROR while installing NativeScript

I just received Z_BUF_ERROR while installing NativeScript. I did Google but without any luck.
Environment:
Windows 10 Enterprise 1703 64-bit
NodeJS v6.11.2
npm v5.3.0
Command:
npm install -g nativescript
Error Log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\Hui\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'nativescript' ]
2 info using npm#5.3.0
3 info using node#v6.11.2
4 verbose npm-session 4454628f9775be96
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/nativescript 1244ms
8 http fetch GET 200 https://registry.npmjs.org/nativescript/-/nativescript-3.1.3.tgz 23ms (from cache)
9 silly fetchPackageMetaData error for nativescript#latest unexpected end of file
10 verbose stack Error: unexpected end of file
10 verbose stack at Zlib._handle.onerror (zlib.js:370:17)
11 verbose cwd D:\Dev\Workspace\Local\Angular
12 verbose Windows_NT 10.0.15063
13 verbose argv "C:\Program Files\nodejs\node.exe" - "C:\Users\Hui\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g" "nativescript"
14 verbose node v6.11.2
15 verbose npm v5.3.0
16 error code Z_BUF_ERROR
17 error errno -5
18 error unexpected end of file
19 verbose exit [ -5, true ]
Any help would be appreciated.
try to clean cache by using this
npm cache clean --force

I'm trying to install all npm modules in ../AppData/Roaming folder. But each time it fails with error code - 4068

I'm simply using the following command: "npm install -g". OS: Windows 8.1, CMD is administrator. Error log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g' ]
2 info using npm#2.5.1
3 info using node#v0.12.1
4 verbose node symlink C:\Program Files\nodejs\node.exe
5 silly cache add args [ '.', null ]
6 verbose cache add spec .
7 silly cache add parsed spec { raw: '.',
7 silly cache add scope: null,
7 silly cache add name: null,
7 silly cache add rawSpec: '.',
7 silly cache add spec: 'C:\',
7 silly cache add type: 'local' }
8 error addLocal Could not install C:\
9 verbose stack Error: EISDIR, read
9 verbose stack at Error (native)
10 verbose cwd C:\
11 error Windows_NT 6.3.9600
12 error argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g"
13 error node v0.12.1
14 error npm v2.5.1
15 error code EISDIR
16 error errno -4068
17 error EISDIR, read
18 error If you need help, you may report this error at:
18 error http://github.com/npm/npm/issues
19 verbose exit [ -4068, true ]
It appears as though you are running npm install -g from your C: drive. npm has absolutely no idea what you want it to install unless you:
pass it arguments, like how npm install -g npm will globally install npm
run it in a directory that contains a package
Since you are not passing the command any arguments, npm assumes you want it to install what is in your current working directory. Since you do not have a package at the root of your C: drive, npm correctly errors out with the EISDIR error ("error: is directory").

Any npm's command is not working

I can attach the error log file
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\\node.exe',
1 verbose cli 'C:\Program
Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'config' ]
2 info using npm#1.4.28
3 info using node#v0.10.35
4 verbose node symlink C:\Program Files\nodejs\node.exe
5 error Error: ENOENT, stat 'c:\'C:\Program'
6 error If you need help, you may report this entire log,
6 error including the npm and node versions, at:
6 error http://github.com/npm/npm/issues
7 error System Windows_NT 6.2.9200
8 error command "C:\Program Files\nodejs\\node.exe" "C:\Program
Files\nodejs\node_modules\npm\bin\npm-cli.js" "config"
9 error cwd c:\
10 error node -v v0.10.35
11 error npm -v 1.4.28
12 error path c:\'C:\Program
13 error code ENOENT
14 error errno 34
15 verbose exit [ 34, true ]
Any npm's command is not working.
I am using windows 8.1 and I installed npm successfully.
I heard that ENOENT error can be fixed if I make a folder relate to the error path but
error path contains 'C:\Program, I cannot make that file.
How can I solve this problem? I tried to uninstall npm, I failed.
This problem happened because I tried to change prefix for npm but something goes wrong
I found way to fix it.
OK, the reason why this problem happened was that I usually use CMD with administrator's admission.
Because of that setting, actually, I don't need to change prefix of npm but I just want to practice what I learn in my current book.
So I tried to change prefix but accidentally, Using
npm config set prefix C:\program files
I changed the prefix 'C:\program' like this.
because of special character : , I cannot create name of fold including : .
because of damn prefix, npm was totally not working.
I searched npm folder, I found npmrc file but it did not help.
Finally, I found .npmrc at C:\Users\myName .
there, the prefix was setted at C:\program .
I delete prefix and Now it is working!!!!!
Bye Bye let's master nodejs

"npm faq" fails on Windows 7 ("spawn ENOENT" errors)

I have installed node.js on Windows 7 with their latest installer. It seemed to work, I can call npm and node from the console (either cmd or PowerShell), but I keep getting errors.
There are a lot of questions here about node.js on windows, but they all mention some specific piece of code. I'm getting the "spawn ENOENT" with a lot of simple commands, for instance yo, if I then pick "update generators" :
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
even npm faq fails :
PS E:\www\something> npm faq
npm ERR! Error: spawn ENOENT
npm ERR! at errnoException (child_process.js:988:11)
npm ERR! at Process.ChildProcess._handle.onexit (child_process.js:779:34)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/isaacs/npm/issues>
It seems that the problem is that node uses unix command names like dir, which do not exist on Windows. Some blog posts mention using Cygwin, but mostly for building node.js, not for calling it. The official nodejs website doesn't mention that cygwin is a prerequisite, either.
Here's the npm-debug.log :
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'faq' ]
2 info using npm#1.3.24
3 info using node#v0.10.25
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 error Error: spawn ENOENT
5 error at errnoException (child_process.js:988:11)
5 error at Process.ChildProcess._handle.onexit (child_process.js:779:34)
6 error If you need help, you may report this *entire* log,
6 error including the npm and node versions, at:
6 error <http://github.com/isaacs/npm/issues>
7 error System Windows_NT 6.1.7601
8 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "faq"
9 error cwd E:\
10 error node -v v0.10.25
11 error npm -v 1.3.24
12 error syscall spawn
13 error code ENOENT
14 error errno ENOENT
15 verbose exit [ 1, true ]
Make sure that you have c:\Windows\System32 on your 'Path' System Variable. I was having this exact problem and this was the fix I needed. I must have taken it out in error sometime in the past.

Resources