I receive the following error when installing angular cli - npm

I am having problems with angular cli again (on a mac). Here is my log. I tried uninstalling the installing however get exactly same error. Any suggestions? Most probably PATH issue??
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'build', 'dev' ]
2 info using npm#3.10.10
3 info using node#v6.10.3
4 info build /Users/user/Documents/Sites/website/dev
5 verbose stack Error: ENOENT: no such file or directory, open '/Users/user/Documents/Sites/website/dev/package.json'
5 verbose stack at Error (native)
6 verbose cwd /Users/user/Documents/Sites/website
7 error Darwin 16.5.0
8 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "build" "dev"
9 error node v6.10.3
10 error npm v3.10.10
11 error path /Users/user/Documents/Sites/website/dev/package.json
12 error code ENOENT
13 error errno -2
14 error syscall open
15 error enoent ENOENT: no such file or directory, open '/Users/user/Documents/Sites/website/dev/package.json'
16 error enoent ENOENT: no such file or directory, open '/Users/user/Documents/Sites/website/dev/package.json'
16 error enoent This is most likely not a problem with npm itself
16 error enoent and is related to npm not being able to find a file.
17 verbose exit [ -2, true ]

You must check if you did npm --init because this might happen that you forgot to initialise npm and there is no package.json file present there which could not be found according to the line 5 of the error.
If that does not work then try this npm install npm#latest -g
If that also does not work then try these :
1. Ensure dependencies described correctly on package.json
2. Then type npm install and Enter.
3. Check issue still exists. and If issue not resolved, continue these
methods.
4. type npm cache clean and hit Enter
5. type sudo npm install -g npm and hit Enter.
6. Retry npm install and hit Enter.

Related

Azure Pipeline build error Npm failed with return code: 4294963238

I am getting NPM error when I am trying to build the solution as follows
144812 error Windows_NT 10.0.17763
144813 error argv "C:\\hostedtoolcache\\windows\\node\\6.17.1\\x64\\node.exe" "C:\\hostedtoolcache\\windows\\node\\6.17.1\\x64\\node_modules\\npm\\bin\\npm-cli.js" "install"
144814 error node v6.17.1
144815 error npm v3.10.10
144816 error path D:\a\45\s\Presentation Tier\VendorPortal.Web.UI\node_modules\.staging\#types\node-b1eb4de5\package.json
144817 error code ENOTDIR
144818 error errno -4058
144819 error syscall open
144820 error ENOENT: no such file or directory, open 'D:\a\45\s\Presentation Tier\VendorPortal.Web.UI\node_modules\.staging\#types\node-b1eb4de5\package.json'
144821 error If you need help, you may report this error at:
144821 error <https://github.com/npm/npm/issues>
144822 verbose exit [ -4058, true ]
##[error]Error: Npm failed with return code: 4294963238
I tried delete package-lock.json, npm cache clean command, npm install npm#latest -g everything. But I am still getting the error. Error occurs in NPM install step.

nextjs Build failed because of webpack errors on CentOS 7

I want to deploy a nextjs application on a centos server. But when i try to build using npm run build it gives me the following error
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist#latest --update-db
info - Creating an optimized production build
Failed to compile.
ModuleNotFoundError: Module not found: Error: Can't resolve '../context/auth/AuthState' in '/var/www/html/projectname/pages'
> Build error occurred
Error: > Build failed because of webpack errors
at build (/var/www/html/projectname/node_modules/next/dist/build/index.js:15:918)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client-ubii-app#0.1.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client-ubii-app#0.1.0 build 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! /root/.npm/_logs/2021-03-31T21_10_01_066Z-debug.log
But when i do the same on my local machine runnig windows 10 it works fine
If you has been change in name of file or folder only case sensitive character, this problem may be happen if your remote branch is not updated. Please, make sure if remote branch has the old name of file or folder. If true, fix it because the CentOs is Linux, so file and folder with same words in lower case is different with upper case.

How to give mkdir permission for npx command

I have problem using npx create-react-app command
Earlier I had create-react-app installed globally on and system and used npm create-react-app command
But I learned that using npx we will always use the latest version and to use npx I have uninstalled create-react-app from my system
Whenever I try to run npx create-react-app my-app command
I get the following error:
C:\Users\Sachin Verma\Desktop\react-project>npx create-react-app tut
Error: EPERM: operation not permitted, mkdir 'C:\Users\Sachin'
command not found: create-react-app
But if I install create-react-app on my system globally, then npx command works
I tried cleaning npm cache and also reinstalled node.js but the problem still exists
Edit:
When running CMD in administrator rights
Microsoft Windows [Version 10.0.19042.685]
(c) 2020 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>cd C:\Users\Sachin Verma\Desktop\react-project\
C:\Users\Sachin Verma\Desktop\react-project>npx create-react-app tutt
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Verma\AppData\Roaming\npm-cache\_npx\14832" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sachin Verma\AppData\Roaming\npm-cache\_logs\2021-01-11T15_27_28_701Z-debug.log
Install for [ 'create-react-app#latest' ] failed with code 1
Content of 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\\Sachin Verma\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'create-react-app#latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli 'C:\\Users\\Sachin',
1 verbose cli 'Verma\\AppData\\Roaming\\npm-cache\\_npx\\14832',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json'
1 verbose cli ]
2 info using npm#6.14.11
3 info using node#v15.5.1
4 verbose npm-session 5f8e13bb496752c5
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for file:Verma\AppData\Roaming\npm-cache\_npx\14832 Could not install from "Verma\AppData\Roaming\npm-cache\_npx\14832" as it does not contain a package.json file.
8 http fetch GET 304 https://registry.npmjs.org/create-react-app 2907ms (from cache)
9 silly pacote tag manifest for create-react-app#latest fetched in 2943ms
10 timing stage:rollbackFailedOptional Completed in 2ms
11 timing stage:runTopLevelLifecycles Completed in 2957ms
12 verbose stack Error: ENOENT: no such file or directory, open 'C:\Users\Sachin Verma\Desktop\react-project\Verma\AppData\Roaming\npm-cache\_npx\14832\package.json'
13 verbose cwd C:\Users\Sachin Verma\Desktop\react-project
14 verbose Windows_NT 10.0.19042
15 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Sachin Verma\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "create-react-app#latest" "--global" "--prefix" "C:\\Users\\Sachin" "Verma\\AppData\\Roaming\\npm-cache\\_npx\\14832" "--loglevel" "error" "--json"
16 verbose node v15.5.1
17 verbose npm v6.14.11
18 error code ENOLOCAL
19 error Could not install from "Verma\AppData\Roaming\npm-cache\_npx\14832" as it does not contain a package.json file.
20 verbose exit [ 1, true ]
Is there any problem due to my username because it contains a space in between?
Try to run your CMD in administration or you can change your working dir, where no admin privilege is required.

why npm-audit fails for react-native-unimodule

I am trying to run npm audit on my react-native project which originally was an expo project and ejected to bare workflow. When I run npm audit, I get
npm ERR! code ELOCKVERIFY
npm ERR! Errors were found in your package-lock.json, run npm install to fix them.
npm ERR! Invalid: lock file's react-native-unimodules#0.9.1 does not satisfy react-native-unimodules#^0.7.0
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kislam/.npm/_logs/2020-06-04T04_13_14_375Z-debug.log
the detail log is as follows
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/Users/kislam/.nvm/versions/node/v12.14.0/bin/node',
1 verbose cli '/Users/kislam/.nvm/versions/node/v12.14.0/bin/npm',
1 verbose cli 'audit'
1 verbose cli ]
2 info using npm#6.14.5
3 info using node#v12.14.0
4 verbose npm-session bcb02cea1f031e3c
5 verbose stack Error: Errors were found in your package-lock.json, run npm install to fix them.
5 verbose stack Invalid: lock file's react-native-unimodules#0.9.1 does not satisfy react-native-unimodules#^0.7.0
5 verbose stack at /Users/kislam/.nvm/versions/node/v12.14.0/lib/node_modules/npm/lib/audit.js:184:19
6 verbose cwd /Users/kislam/bunnings/repos/trades-mobile-app
7 verbose Darwin 19.4.0
8 verbose argv "/Users/kislam/.nvm/versions/node/v12.14.0/bin/node" "/Users/kislam/.nvm/versions/node/v12.14.0/bin/npm" "audit"
9 verbose node v12.14.0
10 verbose npm v6.14.5
11 error code ELOCKVERIFY
12 error Errors were found in your package-lock.json, run npm install to fix them.
12 error Invalid: lock file's react-native-unimodules#0.9.1 does not satisfy react-native-unimodules#^0.7.0
13 verbose exit [ 1, true ]
The package.json has the following associated versions
"expo": "~37.0.3",
"react-native": "~0.61.4",
"react-native-unimodules": "~0.9.0",
Cannot figure out where npm-audit is getting react-native-unimodules#^0.7.0 from.

Node.js NPM error when installing PhoneGap on Windows 8

I don't know if it's just too early in the morning but I can't figure out this error
18075 error Error: ENOENT, lstat 'C:\Users\Philippe\node_modules\phonegap\node_modules\cordova\node_modules\plugman\node_modules\npm\html\doc\api\npm-prune.html'
18076 error If you need help, you may report this log at:
18076 error <http://github.com/isaacs/npm/issues>
18076 error or email it to:
18076 error <npm-#googlegroups.com>
18077 error System Windows_NT 6.2.9200
18078 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "phonegap"
18079 error cwd C:\Users\Philippe
18080 error node -v v0.10.18
18081 error npm -v 1.3.8
18082 error path C:\Users\Philippe\node_modules\phonegap\node_modules\cordova\node_modules\plugman\node_modules\npm\html\doc\api\npm-prune.html
18083 error fstream_path C:\Users\Philippe\node_modules\phonegap\node_modules\cordova\node_modules\plugman\node_modules\npm\html\doc\api\npm-prune.html
18084 error fstream_type File
18085 error fstream_class FileWriter
18086 error code ENOENT
18087 error errno 34
18088 error fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
18088 error fstream_stack Object.oncomplete (fs.js:107:15)
18089 verbose exit [ 34, true ]
I would be very appreciative if someone could give me the short and sweet version.
Thanks
I ran the following commands
npm list -g
it showed me that I have an unmet dependency phonegap... so I ran
npm rm phonegap
npm cache clear
then tried installing it again
npm install -g phonegap
and it worked, the ENOENT error should have been a dead give away that npm was trying to tell me that the supposed files didn't exist or were corrupted.
#Torvos answer: please note sometimes you must run
npm rm -g phonegap
(at least for me this was the case; without -g option it didn't work)