Why can't execute "npm start" or even other npm commands? - node.js

What could the problem be? I get this error whenever i run "npm start" or even basic commands like "npm install." I am trying to figure out why it can't run.
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.32
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart nodetest1#0.0.0
7 info start nodetest1#0.0.0
8 verbose unsafe-perm in lifecycle true
9 info nodetest1#0.0.0 Failed to exec start script
10 error nodetest1#0.0.0 start: `node ./bin/www`
10 error spawn ENOENT
11 error Failed at the nodetest1#0.0.0 start script.
11 error This is most likely a problem with the nodetest1 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 nodetest1
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\Kijo\nodetest1
15 error node -v v0.10.32
16 error npm -v 1.4.28
17 error syscall spawn
18 error code ELIFECYCLE
19 error errno ENOENT
20 verbose exit [ 1, true ]
#nox3011
Here is a printout of my directory, if it can help.

You have a ENOENT error which means it was not able to locate some required file or directory. Mostly with ./bin/www
Try running npm start by changing directory to C:\Program Files\node

Related

package.json bug with npm init -y install

I installed node.js for the sake of sass compiling, i havent touched any of javascript for now so all the documentation I went through to solve this problem is really complicated for me. So when i put npm init -y command in VScode terminal it installs package.json file that has a debug property between line 5 and 6.
when i click on "debug" errors that show into my terminal are these...
"Error: no test specified"
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! c#1.0.0 test: `echo "Error: no test specified" && exit 1`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the c#1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\AppData\Roaming\npm-cache\_logs\2020-09-27T00_42_32_091Z-debug.log
Waiting for the debugger to disconnect...
PS C:\Users\Desktop\c>
And here is log file
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'test'
1 verbose cli ]
2 info using npm#6.14.8
3 info using node#v14.11.0
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle c#1.0.0~pretest: c#1.0.0
6 info lifecycle c#1.0.0~test: c#1.0.0
7 verbose lifecycle c#1.0.0~test: unsafe-perm in lifecycle true
8 verbose lifecycle c#1.0.0~test: PATH: C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\\Desktop\c\node_modules\.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\\AppData\Local\Microsoft\WindowsApps;C:\Users\\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\\AppData\Roaming\npm
9 verbose lifecycle c#1.0.0~test: CWD: C:\Users\\Desktop\c
10 silly lifecycle c#1.0.0~test: Args: [ '/d /s /c', 'echo "Error: no test specified" && exit 1' ]
11 silly lifecycle c#1.0.0~test: Returned: code: 1 signal: null
12 info lifecycle c#1.0.0~test: Failed to exec test script
13 verbose stack Error: c#1.0.0 test: `echo "Error: no test specified" && exit 1`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:314:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:314:20)
13 verbose stack at maybeClose (internal/child_process.js:1047:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid c#1.0.0
15 verbose cwd C:\Users\\Desktop\c
16 verbose Windows_NT 10.0.19041
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
18 verbose node v14.11.0
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error c#1.0.0 test: `echo "Error: no test specified" && exit 1`
22 error Exit status 1
23 error Failed at the c#1.0.0 test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
VScode is giving you a quick way of running 'npm test', which is running exactly as expected. You can specify commands to run in the "scripts" property. As you can see, there is one for "test", which is outputting exactly what is written there. That is what 'debug' does. You need to hook a real test command there for debug to do anything useful.
That debug stuff is the output for a npm run test which you don't care about if you're only installing a package.json so you can install sass for development. If you want to be able to run tests via npm run test, change the value of the key/value pair on line 7 to run your tests.
"test": "someTestCommand.exe"
But again, if you're only doing this to get sass compiling, you can safely ignore it.

How to change the default package.json location in npm?

I have a TestCafe test project.
This is the "scripts" portion of package.json:
"scripts": {
"test": "testcafe chrome tests"
}
When I try to run the npm script, this is what I get:
0 info it worked if it ends with ok
1 verbose cli [
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 'run',
1 verbose cli 'test'
1 verbose cli ]
2 info using npm#6.13.1
3 info using node#v13.3.0
4 verbose stack Error: ENOENT: no such file or directory, open 'E:\package.json'
5 verbose cwd E:\
6 verbose Windows_NT 10.0.18362
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
8 verbose node v13.3.0
9 verbose npm v6.13.1
10 error code ENOENT
11 error syscall open
12 error path E:\package.json
13 error errno -4058
14 error enoent ENOENT: no such file or directory, open 'E:\package.json'
15 error enoent This is related to npm not being able to find a file.
16 verbose exit [ -4058, true ]
So, it is complaining about not finding E:\package.json which is true, because my project is in E:\projectName\.
How can I tell the npm to look for package.json in E:\projectName\package.json? How come it is not searching for it inside the project folder by default?
You can use --prefix option.
In your case:
$ npm --prefix E:\projectName\ ...
This was my mistake.
I was starting the script with npm test instead of with npm run test. Now it is working.

Unable to launch React Project

Please find the error logs which I am getting in the terminal
fruits-vegetables#0.1.0 start C:\Users\MY PC\My_Front_End\fruits-vegetables
> react-scripts start
Could not find a required file.
Name: index.html
Searched in: C:\Users\MY PC\My_Front_End\fruits-vegetables\public
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fruits-vegetables#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fruits-vegetables#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\MY PC\AppData\Roaming\npm-cache\_logs\2019-12-20T15_57_41_927Z-debug.log
Please find the debug error log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\MY PC\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm#6.13.4
3 info using node#v12.10.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle fruits-vegetables#0.1.0~prestart: fruits-vegetables#0.1.0
6 info lifecycle fruits-vegetables#0.1.0~start: fruits-vegetables#0.1.0
7 verbose lifecycle fruits-vegetables#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle fruits-vegetables#0.1.0~start: PATH: C:\Users\MY PC\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\MY PC\My_Front_End\fruits-vegetables\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Users\MY PC\AppData\Local\Microsoft\WindowsApps;C:\Users\MY PC\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\MY PC\AppData\Roaming\npm;C:\Program Files\Git\bin;C:\Program Files (x86)\Nmap
9 verbose lifecycle fruits-vegetables#0.1.0~start: CWD: C:\Users\MY PC\My_Front_End\fruits-vegetables
10 silly lifecycle fruits-vegetables#0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle fruits-vegetables#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle fruits-vegetables#0.1.0~start: Failed to exec start script
13 verbose stack Error: fruits-vegetables#0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\MY PC\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:209:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\MY PC\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:209:13)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid fruits-vegetables#0.1.0
15 verbose cwd C:\Users\MY PC\My_Front_End\fruits-vegetables
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\MY PC\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.10.0
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error fruits-vegetables#0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the fruits-vegetables#0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Moreover, I have already tried these suggestions:
delete node modules and package-lock.json
then ran command: npm update
then ran command: npm install
and when I ran npm start I got the same error as above
One more thing which I noticed, whenever I freshly install a react app then I used to get App.js, index.js, index.html even a src folder, I am not getting all these. Please help!
I'm also faced this issue before but fortunately i fixed it for ever you can fix this by going to the ->control pannel ->system and security ->system-> advanced system settings ->environment variables look for system variables and look for ComSpec make sure the path is like this C:\Windows\system32\cmd.exe and restart the system and see it will work

Trying to Install Grunt-Shopify

(https://github.com/wilr/grunt-shopify)
I am very new to anything related to grunt and node.js
Here is the error I am getting:
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli 'C:\Users\Steven\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'grunt-shopify',
1 verbose cli '--save-dev' ]
2 info using npm#2.4.1
3 info using node#v0.10.36
4 verbose stack Error: EISDIR, read
5 verbose cwd C:\Users\Steven\Desktop\Sublime Text 2\shop
6 error Windows_NT 6.2.9200
7 error argv "node" "C:\Users\Steven\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "grunt-shopify" "--save-dev"
8 error node v0.10.36
9 error npm v2.4.1
10 error code EISDIR
11 error errno 28
12 error EISDIR, read
13 error If you need help, you may report this error at:
13 error http://github.com/npm/npm/issues
14 verbose exit [ 28, true ]
Can anyone tell me what I am doing wrong?? We think it may be a permission issue even though we are running command prompt as admin.
Thanks!

npm start Error: Cannot find module 'C:\' and Exit status 8

I have a little NPM challenge for you.
Tech. info:
OS: Windows 7
I'm trying to:
cd to the project folder --> run npm start, "start" is configured in the package.json as "node ."
I get the following error:
**** npm start Error: Cannot find module 'C:\'
**** Exit status 8
**** the npm-debug.log look like the below:
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.3.24
3 info using node#v0.10.25
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart tile-tease-api#0.1.0
7 info start tile-tease-api#0.1.0
8 verbose unsafe-perm in lifecycle true
9 info tile-tease-api#0.1.0 Failed to exec start script
10 error tile-tease-api#0.1.0 start: `node .`
10 error Exit status 8
11 error Failed at the tile-tease-api#0.1.0 start script.
11 error This is most likely a problem with the tile-tease-api package,
11 error not with npm itself.
11 error Tell the author that this fails on your system:
11 error node .
11 error You can get their info via:
11 error npm owner ls tile-tease-api
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 "FOLDER OF PROJECT - EDITED"
15 error node -v v0.10.25
16 error npm -v 1.3.24
17 error code ELIFECYCLE
18 verbose exit [ 1, true ]
During my troubleshooting I have found:
It seems to have something to do with the invoking path. As I have no problems if I do
** instead of "node ." in the start definition in the package.json file I define the actual path
** or if i execute "node ." in a cmd directly instead of doing it through the "npm start" command.
The issue is that I'm sharing the project between other developers and they are developing on Mac's. On their setup it works with the start "node ."....and it would be cumbersome to have different package.json file and would beat the purpose of using Git.....
Have anyone bumped into this problem before and have any ideas for what I can do to overcome this.
I think it's a bug in node.js core, and it might have something to do with the fact that require() doesn't accept "." as a local path.
Try to write node ./ instead.

Resources