How to setup npm dependencies updating in Intellij on win10 - node.js

I'm using Windows 10, IntelliJ 2020.1 and Node 12
When I run "npm install" from the terminal inside IntelliJ, everything installs like normal. However, when I make an edit to my package.json file and click "Run 'npm install" in the popup in the lower right corner, I receive the follow error:
Specify configs in the ini-formatted file:
C:\Users\me\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm#6.14.4 C:\Users\me\AppData\Roaming\npm\node_modules\npm
Process finished with exit code 1
Am I overlooking a simple IntelliJ config setting? Appreciate any help.
====
and the last entry in the log before the error mentioned above:
at com.intellij.javascript.nodejs.packages.NodePackageUtil.doLoadPackageInfo(NodePackageUtil.java:112)
at com.intellij.javascript.nodejs.packages.NodePackageUtil.loadPackageInfo(NodePackageUtil.java:71)
at com.intellij.javascript.nodejs.settings.NodePackageInfoManager$1.fetch(NodePackageInfoManager.java:23)
at com.intellij.javascript.nodejs.settings.NodePackageInfoManager$1.fetch(NodePackageInfoManager.java:19)
at com.intellij.lang.javascript.bower.cache.PrevRequestSkippingCache.lambda$fetchSync$2(PrevRequestSkippingCache.java:82)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.intellij.lang.javascript.bower.cache.PrevRequestSkippingCache.fetchSync(PrevRequestSkippingCache.java:92)
at com.intellij.lang.javascript.bower.cache.PrevRequestSkippingCache.lambda$fetchAsync$1(PrevRequestSkippingCache.java:72)
at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:222)
at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:201)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:210)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:190)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
2020-04-27 18:45:43,643 [101269107] WARN - ckaging.InstalledPackagesPanel - Cannot fetch the latest version of the installed package npm
com.intellij.javascript.nodejs.packages.NodePackageInfoException: FAILED COMMAND: "C:\Program Files\nodejs\npm.cmd" C:\Users\me\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js info --json npm
EXIT CODE: 1```

You have specified npm.cmd as a Node.js interpreter, but it's not an interpreter, it's a package manager run with Node.js. Please specify a valid path to node.exe - must be C:\Program Files\nodejs\node.exe

Related

Getting code1 command failed error while installing nodemon

I am running this npm i nodemon -D and getting a command failed error. Please click on the above image to view the error.
I tried deleting package.json, removing node_modules, and installing it again, but the error persists. I have been attempting a bunch of solutions to resolve this issue but I don't know why it gives this error again and again.
Error image: This error is coming on my VS code
The issue is resolved by using command npm config set script-shell cmd
and then installing nodemon package by npm install nodemon
Lastly, don't forget to reverse the changes and set it back to default by using npm config set script-shell powershell

npm ERR! code ERR_OSSL_PEM_NO_START_LINE and routines:get_name:no start line when installing ReactJS

I was trying to install react, but it keeps saying aborting installation I'm using node v16-14-0 npm v6-14-11.
npx creat-react-app my-app
npx: installed 67 in 13.6s
creating a new react app in C:\User\adminstrator\my-app.
npm ERR! code ERR_OSSL_PEM_NO_START_LINE
npm ERR! error:0909006c:PEM routines:get_name:no start line
npm ERR! A complete log of this run can be found in:
npm ERR! C:User\adminstrator\my-app\_logs\2021-03-18T12_17_27_469Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-script cra-template has failed.
Deleting generated file... package.json
Try to delete .npmrc from C:\Users{username}. This worked for me.
I also got this kind of error before and uninstalling and deleting all node related files solved the problem.
1 - Uninstall nodejs from Programs & Features with the uninstaller.
2 - Delete these files:
C:\Program Files (x86)\Nodejs
C:\Program Files\Nodejs
C:\Users\{User}\AppData\Roaming\npm
C:\Users\{User}\AppData\Roaming\npm-cache
C:\Users\{User}\.npmrc (and possibly check for that without the . prefix too)
3 - Or you can do this
npm clear cache
then, again check for these files if they are not deleted and
delete these files
C:\User\user\appdata\roaming\npm-cache
C:\User\user\appdata\roaming\npm
C:\User\user\appdata\Local\Temp
C:\programefile\nodejs
4 - go to this C:\User{user} and then unhide it if it was hidden and delete .npmrc file and delete all reated file to it(about 4 or 5 files)
5 - if it is uninstalled successfully (you can check with node --version) then reboot your computer
6 - Then, type this command
npm set registry http://registry.npmjs.org/
7 - and finally you're good to go
npx create-react-app app_name
or
npm install <package-name>
i had the same problem when i tried to create new react app
solution: just go to this address << C:\Users\omar >>
[omar is my user name for you its what your user name is]
and at the bottom you would see a file with the name of << .npmrc >> and delete it

npx react-native init AwesomeProject error enolocal

i got an error while trying to create react native app using npx npx
react-native init AwesomeProject
like the docs said. But i got an error messages
npm ERR! code ENOLOCAL npm ERR! Could not install from
"Indigo\AppData\Roaming\npm-cache_npx\3192" as it does not contain a
package.json file.
npm ERR! A complete log of this run can be found in:
C:\Users\Durio
Indigo\AppData\Roaming\npm-cache_logs\2020-07-08T08_20_54_191Z-debug.log
Install for react-native#latest failed with code 1
i know it's not from the npx because i tried to create react app with npx and it works. Am I the only one who had this?
This is an issue in node which is caused by white space in user name between first-name and last-name in windows.
run the following command after replacing firstname with your windows user firstname in command prompt with administrator access
npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global
I had you try npm cache clear and if using windows you can run command npx react-native init AwesomeProject in Command promt using Run as Administrator
I have faced the same issue, do nothing just a quick fix.
first, run the command npm i react-native#latest -g then create your project with your command i.e npx react-native init myProject
we should check the android SDK path on environment variable. Make sure there is no white space on the SDK path and platform-tools path

node-gyp 5 on Windows: Cannot find npm\node_modules\node-gyp\bin\node-gyp.js

Running npm 6.11.3, node-gyp 5.0.3, VS2019 on Windows 10 v1903, getting this error:
Cannot find module %AppData%\npm\node_modules\node-gyp\bin\node-gyp.js (where %AppData% is expanded to the actual user-specific path).
The error only happens if the build is invoked via npm, i.e.:
npm run build
The package.json file scripts section:
"scripts": {
...
"build": "node-gyp build",
}
If node-gyp build is invoked manually outside npm context, the error is gone.
How do I get rid of the error and still use npm scripts for making builds?
Figured it out.
After upgrading to node-gyp 5 on a Windows 10 build system, I started getting the infamous Error: Cannot find module ... npm\node_modules\node-gyp\bin\node-gyp.js, caused by node_modules\npm-lifecycle\node-gyp-bin being pushed on top of my PATH by npm, exactly as described here.
None of the existing remedies I've found and tried could solve this issue for me, including installing the latest windows-build-tools. Here's exactly what I tried, in the following order:
manually clean up the mess and duplicates in System PATH and User PATH environment vars
reboot
choco unistall nodejs
rd /s %AppData%\npm\
rd /s %AppData%\npm\
choco install nodejs
npm install -g npm#latest
npm install -g node-gyp#latest
npm install -g typescript#latest
I was still getting the missing node-gyp.js error. What did help was to properly set npm config set node_gyp to point to the correct node-gyp.js, as suggested here. Yet somehow the script from that thread didn't work properly for me (as well some other PowerShell/Batch scripts I tried).
Eventually, I've come up with the following PowerShell 6 one-liner that did the trick for me:
pwsh -Command npm config set node_gyp "`u{22}$(Join-Path $(npm root -g) -ChildPath 'node-gyp\bin\node-gyp.js')`u{22}"
Hope this helps others and future-me. I'd still recommend going through the above bullet list for clean troubleshooting.

Webpack failed to compile npm start

I got a project that I need to work on. I forked the project from gitlab, unzipped it into my workspace folder, ran terminal and the following commands
node --version
npm --version
npm install
npm init
npm start
This should have installed all devDependencies (I turned production to false) and the server should be up and running. However, I'm getting the following error
`ERROR in .//src/client/index.js
Module build failed: Error: No ESLint configuration found.
at getLocalConfig ((dir)\node_modules\eslint\lib\config.js:162:35)
at Config.getConfig ((dir)\node_modules\eslint\lib\config.js:259:26)
at processText ((dir)\node_modules\eslint\lib\cli-engine.js:224:33)
at CLIEngine.executeOnText ((dir)\node_modules\eslint\lib\cli-engine.js:754:26)
at lint ((dir)\node_modules\eslint-loader\index.js:44:31)
at Object.module.exports ((dir)\node_modules\eslint-loader\index.js:181:3)
webpack: Failed to compile.`
I do have a eslintrc both on root dir and /src/client. What am I missing here ?

Resources