npm ERR! ENOTDIR: not a directory - jenkins

This error suddenly showed up when we run build on our Jenkins server. We did not change anything.
npm ERR! Linux 3.10.0-957.5.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "install"
npm ERR! node v10.15.3
npm ERR! npm v3.10.10
npm ERR! path /var/lib/jenkins/workspace/node_modules/.staging/#types/datatables.net-2acd857c/package.json
npm ERR! code ENOTDIR
npm ERR! errno -20
npm ERR! syscall open

We had the same error suddenly in the Jenkins build. We found out it was caused when running npm i on a specific module.
In our case it was caused because of an update that was made to a dependency package (#types/mime) in one the used packages (#types/serve-static).
Because the project is a legacy one, we could not update any packages, so to solve the issue we had to prevent the main package (#types/serve-static) from getting the latest version of the dependency ("#types/mime" "*").
The way to do that was by declaring the specific version package in package.json file instead of letting the package install the dependency itself
"#types/mime": "2.0.3"

Related

How to install expo CLI on macbook pro big sur?

I an having issue regarding the installation of expo on the new mac.
When I run this command:
npm install --global expo-cli
I have the error:
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/theowatine/.npm/_logs/2020-11-21T09_26_14_033Z-debug.log
Does anyone know what could be the solution? Thank you for your help!
This is a common issue when using a globally-installed npm. The npm docs contain a page about it.
They recommend reinstalling node/npm with a version manager (like nvm). This is often a very good option if you are developing something locally. If you do that, this problem will go away. You can stop reading this answer if you want.
They also provide a way to configure npm to put the globally installed items in a directory of your choosing. That is a good option too, if a version manager won't work for you for whatever reason.
Another option they mention is using npx instead of globally installing the tool. I use this one a lot and like it quite a bit, but it does mean that you frequently have to remember to prefix commands you see with npx.
There are two somewhat common options that they do not list. One is to run your install with sudo. This means that any lifecycle scripts will get run as root on your machine. This is generally a bad idea (which is why they don't mention it in the docs), but is very common.
Another option is to chmod your /usr/local/lib/node_modules directory such that you can write to it. This is also a not-great idea in my opinion (which is probably why it too is not mentioned in the docs), but people do it.
In the case of expo-cli and in most developing-something-locally cases, installing with a package manager like nvm is probably the way to go.
I am also using macOS Big Sur on mbp and i experienced same issue. After reading Trott's answer i downloaded node from https://nodejs.org/en/download/ and installed it. Now expo and react native working fine.
Homebrew version of node is failed to install expo at all time but direct download from nodejs.org worked fine.
try this:
sudo npm install -g expo-cli
I am using Big sur(11.4) and I have downloaded latest version of node
https://nodejs.org/en/download/
Then run the following command for install expo and its working fine.
npm install --global expo-cli

Errors trying to publish npm package

I published fine last week but I tried today and it does not work on any of my computers. It is weird, at first I thought there was an issue with the service but then I started doing some solutions I found on the web and now I get this when I try npm adduser:
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/estebanpadilla/-/user/org.couchdb.user:ludusy
npm ERR! 404
npm ERR! 404 'org.couchdb.user:ludusy' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404 1. name can only contain URL-friendly characters
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/estebanpadilla/.npm/_logs/2020-08-11T03_27_17_364Z-debug.log
I looked all over for a possible solution but nothing seems to work.
npm whoami gives this result:
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in.
npm ERR! need auth You need to authorize this machine using `npm adduser`
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/estebanpadilla/.npm/_logs/2020-08-11T03_29_57_501Z-debug.log
Does anyone have an idea on how to get it working again?
Thank you.
It looks like you're not logged in. I think you need to run npm adduser and follow the prompts.
Just a quick tip -- make sure to carefully read the error message. I think this line is telling you exactly what you need to do! npm ERR! need auth You need to authorize this machine using npm adduser.
It is working now, for some reason I was not able to run npm adduser or npm whoami on the project directory but I was able on any other directory so I figure there was something wrong with some configuration file inside the project. I removed any file that wasn't essential and it work.
Thanks for your help.

I wanna reinstall expo-cli, but there is err. And can't uninstall expo-cli

I tried to build the app through expo but failed, and I tried to reinstall expo-cli.
So, I entered the code below to remove the expo-cli.
npm -g uninstall expo-cli --save
and
(base) Bongui-MacBookPro:expo-firebase-master bong$ npm uninstall expo-cli -g
up to date in 0.042s
However, if i type expo, it will run.
So if you ignore it again and try to reinstall expo-cli,
The following errors occur:
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/expo-cli/bin/expo.js
npm ERR! dest /Users/bong/npm-global/bin/expo-cli
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/expo-cli/bin/expo.js' -> '/Users/bong/npm-global/bin/expo-cli'
npm ERR! File exists: /Users/bong/npm-global/bin/expo-cli
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/bong/.npm/_logs/2020-01-28T09_18_38_604Z-debug.log
Thank you, teachers.
Please help me solve the problem.
Thank you.
I think you might want to overwrite your current folder while you building.
Try and use the --force extension in your command and that will resolve the problem. I presume something like : npm install -g --force expo-cli
I hope that will help.
I am using linux , Ubuntu i tried
sudo npm install -g --force expo-cli
it worked for me.

Cannot read property 'map' of undefined npm ERR! code ELIFECYCLE npm ERR! errno 1 fir React Front End/Rails Backend

I get this error message when I run npm start:
Cannot read property 'map' of undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! quote-react-redux#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the quote-react-redux#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Anyone have an idea of what is going on? Or is there any documentation to read npm error logs as well?
I have gotten similar errors, ie. to reproduce one of mine:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gatsby-starter-default#0.1.0 develop: `gatsby develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gatsby-starter-default#0.1.0 develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
The problem occurs when I am running a different version of node than the one I used to either generate the app with, or perhaps was cloned from elsewhere and forgot to run npm install.
Fix 1: Change the node version to the same version the app was generated with in the directory you are trying to launch the server via your node version manager.
Fix 2: Make sure you have the node version you want to run set in the directory you are working in, then npm install. You may want to do this in an new git branch, until you get it running, then merge into master, as sometimes if the versions were really different you may need to manually install additional packages (they will be listed).
Fix 3: Clear out and start from scratch (probably better than Fix 2). Try:
npm cache clean --force
rm package-lock.json
/bin/rm -rf node_modules/
npm install

Using yo to update a Yeoman generator initially installed from a GIT url

My generator is not in NPM registry. I install it running:
npm install -g git://domain.com/scope/generator-foo.git
Now I would like to update it using yo with the Update your generator menu item, but I get the following error:
yo
? 'Allo Yves! What would you like to do? Update your generators
? Generators to update: #scope/generator-foo
npm ERR! Darwin 14.4.0
npm ERR! argv "/Users/yves/.nvm/versions/node/v0.12.6/bin/node" "/Users/yves/.nvm/versions/node/v0.12.6/bin/npm" "install" "-g" "#scope/generator-foo"
npm ERR! node v0.12.6
npm ERR! npm v2.11.2
npm ERR! code E404
npm ERR! 404 Not found : #scope/generator-foo
npm ERR! 404
npm ERR! 404 '#scope/generator-foo' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Yep, '#scope/generator-foo' is not in the npm registry., and no I don't want to publish it on NPM :)
Is there a way to configure my generator so Yeoman can update it with it's git url instead of the package name?
I know I can update my generator manually using npm install git:// but I want to be able to yo
You could publish it to the npm registry. Or like you said, update it manually. By the way, to update, its npm up -g generator-foo

Resources