Npm install doesn't work on Windows 10 - node.js

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.

Related

when creating new angular project - package install failed

Error while creating a new project using angular cli .it shows
3492 verbose stack Error: 404 Not Found - GET https://registry.npmjs.org/error-ex
3492 verbose stack at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-registry-fetch\check-response.js:104:15
3492 verbose stack at runMicrotasks (<anonymous>)
3492 verbose stack at processTicksAndRejections (internal/process/task_queues.js:93:5)
3493 verbose statusCode 404
3494 verbose pkgid error-ex#^1.3.1
3495 verbose cwd C:\Users\amemni\Angular\test\testt
3496 verbose Windows_NT 10.0.17134
3497 verbose argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--quiet"
3498 verbose node v12.13.0
3499 verbose npm v6.12.0
3500 error code E404
3501 error 404 Not Found - GET https://registry.npmjs.org/error-ex
3502 error 404
3503 error 404 'error-ex#^1.3.1' is not in the npm registry.
3504 error 404 You should bug the author to publish it (or use the name yourself!)
3505 error 404 It was specified as a dependency of 'parse-json'
3506 error 404 Note that you can also install from a
3507 error 404 tarball, folder, http url, or git url.
3508 verbose exit [ 1, true ]
i've tried :
1 -npm clear cache --force and manually deleted the npm cache folder
2- upgrade and change angular cli version
3- change the registry with : npm config set registry http://registry.npmjs.org
None of them worked
Angular CLI: 9.0.1
Node: 12.13.0
OS: win32 ia32
Windows 10
See this issue
npm install fails with 'error-ex#^1.3.1' is not in the npm registry
There is currently a missing NPM package repository (404) - so all npms dependent on that package are broken. It's being tracked in that thread and for those of us affected, we'll update that thread as well.
Set the registry to this and , install the dependency globally. Then re-do the creation of new app.
npm config set registry http://registry.npm.taobao.org
npm install -g error-ex#1.3.1
ng new my-new-app
source :https://github.com/Qix-/node-error-ex/issues/13

after create-react-app failed to start script

Failed at the start script and didn't run nothing, while running the following command:
npm start
The Error
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"webpack-dev-server": "3.2.1"
Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack-dev-server was detected higher up in the tree:
/home/akhilbatchu/node_modules/webpack-dev-server (version: 3.8.1)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "webpack-dev-server" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if /home/akhilbatchu/node_modules/webpack-dev-server is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls webpack-dev-server in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed webpack-dev-server.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! appnamsse#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the appnamsse#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! /home/akhilbatchu/.npm/_logs/2019-11-14T06_22_13_747Z-debug.log
Here is the complete log about what happened:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/home/akhilbatchu/.nvm/versions/node/v12.13.0/bin/node',
1 verbose cli '/home/akhilbatchu/.nvm/versions/node/v12.13.0/bin/npm',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm#6.12.0
3 info using node#v12.13.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle appnamsse#0.1.0~prestart: appnamsse#0.1.0
6 info lifecycle appnamsse#0.1.0~start: appnamsse#0.1.0
7 verbose lifecycle appnamsse#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle appnamsse#0.1.0~start: PATH: /home/akhilbatchu/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/akhilbatchu/appnamsse/node_modules/.bin:/home/akhilbatchu/.nvm/versions/node/v12.13.0/bin:/home/akhilbatchu/anaconda3/bin:/home/akhilbatchu/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
9 verbose lifecycle appnamsse#0.1.0~start: CWD: /home/akhilbatchu/appnamsse
10 silly lifecycle appnamsse#0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle appnamsse#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle appnamsse#0.1.0~start: Failed to exec start script
13 verbose stack Error: appnamsse#0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/akhilbatchu/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
13 verbose stack at ChildProcess.<anonymous> (/home/akhilbatchu/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:210:5)
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 appnamsse#0.1.0
15 verbose cwd /home/akhilbatchu/appnamsse
16 verbose Linux 4.15.0-64-generic
17 verbose argv "/home/akhilbatchu/.nvm/versions/node/v12.13.0/bin/node" "/home/akhilbatchu/.nvm/versions/node/v12.13.0/bin/npm" "start"
18 verbose node v12.13.0
19 verbose npm v6.12.0
20 error code ELIFECYCLE
21 error errno 1
22 error appnamsse#0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the appnamsse#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 ]
Versions:
Node: v12.13.0
NPM: v6.12.0
Environment
react: "^16.11.0",
react-dom: "^16.11.0",
react-scripts: "3.2.0"
Could anyone please help me as I am not able to figure out what is going wrong and completely new to react.
Thank you.
Have you installed the dependencies .
npm install
If it doesn't work delete the node_modules folder from project. then
npm install
npm start
Did you read the first error message?
It says (step 6) you have (accidentally, probably) installed a copy of webpack-dev-server into your home directory
/home/akhilbatchu/node_modules/webpack-dev-server
Get rid of that copy (for instance, rename /home/akhilbatchu/node_modules into /home/akhilbatchu/node_modules_unused if you don't want to outright remove it), then try again.
I did followed this steps to work
npm install -g npm#latest it'll update npm, in case your modules are not updated
rm -rf node_modules
Delete node_modules in your project folder. as mentioned in the log
npm install
Run npm install or yarn, depending on the package manager you use. as it is mentioned in the console

issue with firebase functions deployment and npm

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!

Grunt stopped working all of a sudden

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.

npm install doesn't work in Windows PowerShell

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

Resources