So my problem is this. I have a project with a package.json. When I in the command prompt (cmd.exe) run "npm install" everything installs as expected. However when I do the exact same thing in PowerShell (powershell.exe) I get an error: "npm ERR! Error: ENOENT, open 'c:\package.json'" even though I ran "npm install" in the path of the project. It always searches for package.json in c: for some reason I can't understand.
Below is the npm-debug.log (which also is written i c: even though my path is c:\code\myProject):
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' ]
2 info using npm#1.3.11
3 info using node#v0.10.21
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 error install Couldn't read dependencies
6 error Error: ENOENT, open 'c:\package.json'
7 error If you need help, you may report this log at:
7 error <http://github.com/isaacs/npm/issues>
7 error or email it to:
7 error <npm-#googlegroups.com>
8 error System Windows_NT 6.2.9200
9 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
10 error cwd c:\
11 error node -v v0.10.21
12 error npm -v 1.3.11
13 error path c:\package.json
14 error code ENOENT
15 error errno 34
16 verbose exit [ 34, true ]
I can't find a solution to this problem anywhere. The PATH variable is setup correctly since both node and npm itself works.
For me, it was much easier to do this in Powershell.
$env:Path += ";C:\Program Files\nodejs\"
Ran "npm" in powershell, and came up straight away.
Use .npmrc to set the prefix explicitly:
Go to \Users\%USERNAME%\.npmrc. For example, in Powershell:
Notepad "\Users\$env:USERNAME\.npmrc"
Set the prefix:
prefix = "C:/Program Files/nodejs"
References
Is there a manual install of node.js for Windows 7?
Opening a program with PowerShell from a shortcut
nodeJS Modules: Loading from the Global Folders
npm config Readme
npm Folders: prefix configuration
nodejs source: legacy-npm-self-install.js
forward slash usage
Related
i have some deployment issues with deployment of my firebase functions, I can see that is a problem with npm, i have tried with 5 different versions of npm while running as admin but it still doesn't work, anyone got an idea og what is wrong? i have added the cmd print and the npm 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 '--prefix',
1 verbose cli '$RESOURCE_DIR',
1 verbose cli 'run',
1 verbose cli 'lint' ]
2 info using npm#5.6.0
3 info using node#v8.9.4
4 verbose stack Error: ENOENT: no such file or directory, open
'C:\Users\nstavsholm\Desktop\NIKLAS\Praktik\bitcoin-info-action-
master\$RESOURCE_DIR\package.json'
5 verbose cwd C:\Users\nstavsholm\Desktop\NIKLAS\Praktik\bitcoin-info-action-
master
6 verbose Windows_NT 6.3.9600
7 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "--prefix" "$RESOURCE_DIR" "run" "lint"
8 verbose node v8.9.4
9 verbose npm v5.6.0
10 error path C:\Users\nstavsholm\Desktop\NIKLAS\Praktik\bitcoin-info-action-master\$RESOURCE_DIR\package.json
11 error code ENOENT
12 error errno -4058
13 error syscall open
14 error enoent ENOENT: no such file or directory, open 'C:\Users\nstavsholm\Desktop\NIKLAS\Praktik\bitcoin-info-action-master\$RESOURCE_DIR\package.json'
15 error enoent This is related to npm not being able to find a file.
16 verbose exit [ -4058, true ]
1. Try to replace $RESOURCE_DIR with %RESOURCE_DIR% in your firebase.json file.
or
2. (This one should solve the issue without workaround)
npm install -g git://github.com/firebase/firebase-tools#master
please try this installation again in ur project folder it should solve the issue.
Ridham Tarpara's comment under the question saved me.
I had kept trying to npm install a package to the project at the folder level.
But the package.json files are in the functions folder on firebase functions projects...
...so you have to cd into the functions folder and then install.
This solved my errors!
I'm new to electron and I am trying to get it up and running on my machine. I am trying to follow along with a tutorial titled 'Creating Your First Desktop App With HTML, JS and Electron'.
I set up the folder where I wanted the files to be downloaded to and extracted them to it but after running npm intall (I did the npm start) an error showed up. this log came back. Please help me understand how to properly install or give file names need to make electron run.
I am using a windows 10 x64 machine.
here is the log
0 info it worked if it ends with ok
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 'start' ]
2 info using npm#3.10.5
3 info using node#v4.4.7
4 verbose stack Error: ENOENT: no such file or directory, open 'c:\Users\Desktop\WestHelper\package.json'
4 verbose stack at Error (native)
5 verbose cwd c:\Users\Desktop\WestHelper
6 error Windows_NT 10.0.10586
7 error argv "C:\Program Files\nodejs\node.exe"
"C:\Users\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "start"
8 error node v4.4.7
9 error npm v3.10.5
10 error path c:\Users\Desktop\WestHelper\package.json
11 error code ENOENT
12 error errno -4058
13 error syscall open
14 error enoent ENOENT: no such file or directory, open 'c:\Users\Desktop\WestHelper\package.json'
15 error enoent ENOENT: no such file or directory, open 'c:\Users\Desktop\WestHelper\package.json'
15 error enoent This is most likely not a problem with npm itself
15 error enoent and is related to npm not being able to find a file.
16 verbose exit [ -4058, true ]
the idea behind NPM is to install packages from package.json shipped with application, so everybody can download dependencies and packages used in project. Because of this, when you run npm install, it searches current directory for file named package.json and tries to read dependency tree from it. The message you posted says, it could not find any in directory c:\Users\Desktop\WestHelper\package.json
If I've found correct tutorial, there is a section called How it’s made where the content package.json file is present.
Hope it helped, have a wonderful day.
T
i have an issue with nodejs. I'm trying to install ember.js library through the command line. When i launch "npm install" command this log appear:
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' ]
2 info using npm#2.11.3
3 info using node#v0.12.7
4 verbose config Skipping project config: C:\Users\Antonio/.npmrc. (matches userconfig)
5 verbose readDependencies loading dependencies from C:\Users\Antonio\package.json
6 error install Couldn't read dependencies
7 verbose stack Error: ENOENT, open 'C:\Users\Antonio\package.json'
7 verbose stack at Error (native)
8 verbose cwd C:\Users\Antonio
9 error Windows_NT 6.3.9600
10 error argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
11 error node v0.12.7
12 error npm v2.11.3
13 error path C:\Users\Antonio\package.json
14 error code ENOPACKAGEJSON
15 error errno -4058
16 error package.json ENOENT, open 'C:\Users\Antonio\package.json'
16 error package.json This is most likely not a problem with npm itself.
16 error package.json npm can't find a package.json file in your current directory.
17 verbose exit [ -4058, true ]
I've visited NPM Troubleshooting but i can't found the solution (i tried the three options but nothing happen).
Just to say: there is yet a folder named "npm" in AppData/Roaming.
The correct way to install ember is:
npm install -g ember-cli
ember new my-app
npm install by itself only works if you have a package.json in the directory where you type it.
I had this same issue trying to install some node modules to a fresh installation of Sails. I found the solution in this link: https://github.com/npm/npm/issues/9676
Just removed node_modules from my root and then npm install again, then I was able to install other modules as well.
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.
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.