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.
Related
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.
I installed the latest version of node and electron and tried out the samples. They work when I enter "npm start".
However: when I try to make an app in another folder and launch it, I get this npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm#3.10.10
3 info using node#v6.11.2
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle proton-template-app#1.0.0~prestart: proton-template-app#1.0.0
6 silly lifecycle proton-template-app#1.0.0~prestart: no script for prestart, continuing
7 info lifecycle proton-template-app#1.0.0~start: proton-template-app#1.0.0
8 verbose lifecycle proton-template-app#1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle proton-template-app#1.0.0~start: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/erik/Projects/Electron/tmp2/node_modules/.bin:/home/erik/bin:/home/erik/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
10 verbose lifecycle proton-template-app#1.0.0~start: CWD: /home/erik/Projects/Electron/tmp2
11 silly lifecycle proton-template-app#1.0.0~start: Args: [ '-c', 'electron .' ]
12 info lifecycle proton-template-app#1.0.0~start: Failed to exec start script
13 verbose stack Error: proton-template-app#1.0.0 start: `electron .`
13 verbose stack spawn ENOENT
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:33:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:891:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
14 verbose pkgid proton-template-app#1.0.0
15 verbose cwd /home/erik/Projects/Electron/tmp2
16 error Linux 4.4.0-79-generic
17 error argv "/usr/bin/node" "/usr/bin/npm" "start"
18 error node v6.11.2
19 error npm v3.10.10
20 error file sh
21 error code ELIFECYCLE
22 error errno ENOENT
23 error syscall spawn
24 error proton-template-app#1.0.0 start: `electron .`
24 error spawn ENOENT
25 error Failed at the proton-template-app#1.0.0 start script 'electron .'.
25 error Make sure you have the latest version of node.js and npm installed.
25 error If you do, this is most likely a problem with the proton-template-app package,
25 error not with npm itself.
25 error Tell the author that this fails on your system:
25 error electron .
25 error You can get information on how to open an issue for this project with:
25 error npm bugs proton-template-app
25 error Or if that isn't available, you can get their info via:
25 error npm owner ls proton-template-app
25 error There is likely additional logging output above.
26 verbose exit [ 1, true ]
I'm afraid my install wasn't 100% ok, what should I do? Install again? How do I uninstall correctly? - I'm stuck, please help ;-)
The technicality is in your package.json, and your installation of Electron, but this is regardless of having it saved under dependencies.
If your start script in package.json calls electron ., you will need to install Electron globally with npm install electron -g. This goes for all commands where you use the name, much like mocha and cordova create. Just some examples.
To use it locally (non-globally) and only inside the project, you can just call npm install electron (which you may have done), but your startscript will have to point to the electron file inside the local node_modules folder. Usually the path is node_modules/.bin/electron.cmd, and your start script can look like node_modules/.bin/electron .
If you ever come across this problem inside an IDE, you should set electron.cmd in .bin as your executable, then . as your arguments.
Make sure you have installed electron globally, to do so run the following command:
npm install -g electron
Once you have installed it try running electron in your command prompt it should open a demo app.
To uninstall electron from the global scope:
npm uninstall -g electron
Totally new to NodeJS
when trying to create a new application getting the following :
it does not create instead exits with a error log at the location
H:\app>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (app)
H:\app>
Contents of 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 'init' ]
2 info using npm#3.10.10
3 info using node#v6.11.0
4 verbose stack Error: read EINVAL
4 verbose stack at exports._errnoException (util.js:1018:11)
4 verbose stack at TTY.onread (net.js:568:26)
5 verbose cwd H:\app
6 error Windows_NT 6.1.7601
7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "init"
8 error node v6.11.0
9 error npm v3.10.10
10 error code EINVAL
11 error errno EINVAL
12 error syscall read
13 error read EINVAL
14 error If you need help, you may report this error at:
14 error <https://github.com/npm/npm/issues>
15 verbose exit [ 1, true ]
any help is much appreciated!
Try this command: npm init - y
By default the command above will create a default package.json at the current directory. It seems there is some problem regarding access. Once the default package.json file is created you can update it afterwards.
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
Tried running Grunt build and Grunt watch on my project yesterday and I ran into the follow error:
Fatal Error: Unable to find local grunt.
I made sure the files weren't deleted. I tried reinstalling Node and Grunt. Files are there and reinstalling didn't work. I've included the debug file for reference. Does anyone know what the issue could be?
0 info it worked if it ends with ok
1 verbose cli [ 'E:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'E:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm#1.3.24
3 info using node#v0.10.25
4 verbose node symlink E:\Program Files\nodejs\\node.exe
5 error install Couldn't read dependencies
6 error package.json ENOENT, open 'D:\sites\alleywire\package.json'
6 error package.json This is most likely not a problem with npm itself.
6 error package.json npm can't find a package.json file in your current directory.
7 error System Windows_NT 6.1.7601
8 error command "E:\\Program Files\\nodejs\\\\node.exe" "E:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
9 error cwd D:\sites\alleywire
10 error node -v v0.10.25
11 error npm -v 1.3.24
12 error path D:\sites\alleywire\package.json
13 error code ENOPACKAGEJSON
14 error errno 34
15 verbose exit [ 34, true ]
You need to install grunt locally with your project (install without -g). This is not the same as grunt-cli which is the grunt command on your command line.
Run npm install inside your project folder if you have a package.json file there.