When I’m going to create new angular project using . This error occurred. Could you guys please, tell me how to solve this issue.
e$ ng new angular-the-basics
create angular-the-basics/e2e/app.e2e-spec.ts (300 bytes)
create angular-the-basics/e2e/app.po.ts (208 bytes)
create angular-the-basics/e2e/tsconfig.e2e.json (235 bytes)
create angular-the-basics/karma.conf.js (923 bytes)
create angular-the-basics/package.json (1302 bytes)
create angular-the-basics/protractor.conf.js (722 bytes)
create angular-the-basics/README.md (1032 bytes)
create angular-the-basics/src/app/app.component.css (0 bytes)
Installing packages for tooling via npm.
npm WARN deprecated nodemailer@2.7.2: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm WARN deprecated uws@9.14.0: stop using this version
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: httpntlm@1.6.1 (node_moduleshttpntlm):
npm WARN network SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/httpntlm/-/httpntlm-1.6.1.tgz failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: escodegen@1.9.1 (node_modulesescodegen):
npm WARN network SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/escodegen/-/escodegen-1.9.1.tgz failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: uglify-to-browserify@1.0.2 (node_modulesuglify-to-browserify):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: Cannot cd into 'D:Gitangular-projectangular-the-basicsnode_modules.staginguglify-to-browserify-f9ddd93a'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: degenerator@1.0.4 (node_modulesdegenerator):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: Cannot cd into 'D:Gitangular-projectangular-the-basicsnode_modules.stagingdegenerator-b0b187d9'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: optionator@0.8.2 (node_modulesoptionator):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: Cannot cd into 'D:Gitangular-projectangular-the-basicsnode_modules.stagingoptionator-d20f57c5'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: pac-resolver@3.0.0 (node_modulespac-resolver):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: Cannot cd into 'D:Gitangular-projectangular-the-basicsnode_modules.stagingpac-resolver-ce15981e'
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:UserslilanAppDataRoamingnpm-cache_logs2018-05-21T07_33_59_772Z-debug.log
Package install failed, see above.
Package install failed, see above.
node -v
v9.4.0
npm -v
5.6.0
ng -v
Angular CLI: 1.6.6
OS: win32 x64
asked May 21, 2018 at 7:52
6
I don’t know especially if it will fix your problem but you can try this, It worked for me:
- Delete manually directory
npm
andnpm-cache
in...AppData/Roaming
- Run in your terminal
npm cache clean --force
- Install your package
npm install -g @angular/cli
Good work =)
j3ff
5,4797 gold badges41 silver badges51 bronze badges
answered Apr 10, 2020 at 23:37
AymenAymen
961 silver badge2 bronze badges
npm cache clean —force when its complete you can then run npm install
answered Sep 25, 2018 at 15:02
if you using mac then use
rm package-lock.json
and for window user use
del package-lock.json
After that just run
npm install
hope will help.good luck
answered Jan 24, 2019 at 11:03
anil sonianil soni
651 silver badge4 bronze badges
0
use the following commands at your terminal:
—delete node modules and package-lock.json
yarn install or npm install
npm start
answered Aug 12, 2019 at 6:52
Bansi29Bansi29
1,0305 silver badges22 bronze badges
My error was :
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersSHILPAAppDataRoamingnpm-cache_logs2020-12-28T22_23_22_383Z-debug.log
Solution:
- delete your npm and npm-cache from your Roaming directory or any where it is present
- Then go to your vs code or terminal and be on the folder which you are creating the project like (my app).
Enter this command
npm install npm@latest -g - and now run npx create-react-app ./ OR npx create-react-app my-app
Happy Hacking!!!!!
answered Dec 28, 2020 at 23:48
1
Create a new folder—-> npm install
——>If errr comes again delete node module half downloaded folder and try—->(npm cache clean —force)——>npm install OR npm install -g @angular/cli
answered Nov 12, 2021 at 7:43
npm cache clean —force simply add this command in your command line and then start your work. Its worked for me.
answered Sep 18, 2019 at 7:23
Yes, I also got same issue while creating angular app through cmd. But in my case , Internet is not stable while creating app. After getting this issue , I deleted previous app and again create new app with proper internet connection. Then new app will be created
answered Mar 28, 2022 at 8:36
First, you need to clear the npm cache.
Run this command to clear npm cache npm cache clean --force
Then reinstall the npm using npm install
Now run your project using npm start
or something else based on the framework you are using. Thank you!
answered Nov 4, 2019 at 17:02
listed below some steps solved this error
1-> open the your project folder in your editor
2-> Right click of the your project and select «Open In Terminal»
3-> Display the your path in console then type npm start
your project development start in browser
Thank You…
answered Feb 29, 2020 at 4:33
Same problem i tried sudo npm start it worked….
answered Apr 28, 2020 at 8:10
1
Delete this folder «npm-cache»
path:C:NODEJSnpm-cache
then create one folder inside C:
open command prompt C:angular>
here angular is my folder name
then install packages npm install @angular/cli -g
then later ng new Hello
Hello is my project name
answered Jun 9, 2020 at 4:00
if your on linux or unix like os , then this is because you have to run this command under root privileges like this —
sudo npm install yourpackage
Dharman♦
29.3k21 gold badges80 silver badges131 bronze badges
answered Oct 6, 2020 at 8:27
I was also struggling for a few minutes with this problem but later what I noticed was I was not inside my project folder and was forcibly trying to run the project outside the project folder.
Make sure you are inside your project folder and run the commands.
Dharman♦
29.3k21 gold badges80 silver badges131 bronze badges
answered Dec 20, 2020 at 7:39
Badal SBadal S
4171 gold badge3 silver badges18 bronze badges
A complete log of this run can be found in: npm ERR!
C:Usersjems bondAppDataRoamingnpm-cache_logs2021-03-27T14_40_47_500Z-debug.log
Package install failed, see above.
this same error occurs for me, so I solved the following ways:
step-1} delete your npm-cache folder from your Roaming directory like:
C:Usersjems bondAppDataRoaming
step-2} next go to your directory, where you want to create a new folder
step-3} run the following command
npm install
step-4} create your project
ng new myNewApp
i hope your error is solved, Thank you.
answered Mar 27, 2021 at 15:17
It can’t find the run file… if you haven’t deleted it, then you are just located inside the wrong folder in your terminal that’s all.
DO NOT clean cache or anything like that if not necessary.
Use cd
use npm start
And it will be good to go.
answered Oct 6, 2021 at 16:44
Outside of the folder not in project there is single file named : package-lock.json
1- delete package-lock.json file.
2- install your package
thats work for me
answered Mar 13, 2022 at 18:40
I had the same problem with React.
It is Slow Internet, the thing worked for me is: npx create-react-app -f
-f
Flag means Forcefully
answered Apr 2, 2022 at 10:02
same issues happened to me when installing dependecies in my next js app,
i disable my protection by using —force[-f] this enable me to install it with ease.
i.e.
npm i better-react-spinkit -f
same as below
npm install [package-name] -f
this method work for me meaning just add [-f] to the end of whatever you are installing
answered Apr 22, 2022 at 6:16
RaySunRaySun
1015 bronze badges
install all the essential files for NODE when installing.
ubuntu : sudo apt install build-essential
answered Jun 17, 2022 at 9:06
I followed these steps:
- delete
nodemodules
andpackage-lock.json
- Run this command
npm cache clean --force
- then go to
npm-cache
(path is shown in your error statement) and
then delete that directory. - install latest version on npm.
- then
npm install
andnpm start
If any error again comes then check which package is throwing error then change the version of that package (version shown in the console error) in package.json.
Then npm install
and npm start
.
Then you wile fine.
answered Oct 1, 2022 at 15:11
Same issue when npm run stop and again start after installing/adding some plugin
But it is solve by just copy and paste the project in different folder and open from that location and run it
answered Jun 10, 2019 at 9:29
start the server from the visual studio code first and after compilation then use «npm run build» in the command prompt. By doing this the issue is resolved.It effectively packages React underway mode and improves the work for the best execution.
answered Jun 12, 2019 at 5:17
following steps you have to follow:
1- delete package-lock.json
file.
2- install your package
3- run your project command
answered Jul 30, 2019 at 13:57
WapShivamWapShivam
92412 silver badges18 bronze badges
Can you please provide a description of your issue? Please use the issues template.
Closing this issue due to lack of description. Feel free to provide a description and reopen.
$ npm start
npm ERR! path D:codekulpackage.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open ‘D:codekulpackage.json ‘
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersDellAppDataRoamingnpm-cache_logs2017-09-23T12_07_34_6 08Z-debug.log
How can i solve this above issue ??
Hey you have made a syntax mistake somewhere in your html css code. Some thing just happened to me I was using double hash with a color like ##u0008. After removing a hash from code my problem was solved. Look for a mistake something like your issue will be resolved.
I am facing the same issue when I run npm start
from terminal. I got this error
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! /home/niranjan/.npm/_logs/2018-08-24T07_36_58_171Z-debug.log
I am using Ubuntu-16.04
Need help!
npm ERR! path C:UsersIbro_Joe_DIABATEDocumentsEDACYMy CoursesProgrammationAngularMes TPsfirstProjectNodeJSpackage.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open ‘C:UsersIbro_Joe_DIABATEDocumentsEDACYMy CoursesProgrammationAngularMes TPsfirstProjectNodeJSpackage.json’
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersIbro_Joe_DIABATEAppDataRoamingnpm-cache_logs2018-12-05T18_44_53_692Z-debug.log
Pls help
I am also finding an npm error after typing npm install saying
«A complete log of this file can be found in» with some memory address completely different from the place I am using this command in cmd. Pls see this
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-01-07T11_38_35_380Z-debug.log
root@fragoso-H61M-S2-B3:/home/fragoso/salao# node —version
Estou com esse problema aqui, alguém pode me ajudar a resolver?
try this
«scripts»: {
«test»: «make test»,
«start»: «node index.js»
}
@niranjanreddy891 remove a package-lock.json file and run npm install it Will work
//Windows
del package-lock.json
npm install
I was getting the same error and I got it
cause wasn’t positioned in the correct folder.
make sure you’re positioned in the project folder
@niranjanreddy891 remove a package-lock.json file and run npm install it Will work
//Windows
del package-lock.json
npm install
not work still having same error
PS C:UsersGrabielDesktopnode7-restserver> npm i jsonwebtoken —save
npm ERR! Unexpected end of JSON input while parsing near ‘…onal-changelog»:»~1.1’
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersGrabielAppDataRoamingnpm-cache_logs2019-05-12T16_11_24_556Z-debug.log
PS C:UsersGrabielDesktopnode7-restserver>
Hi guys, I have this error and I would like to know why when installing this dependency this error jumps me.
`
$ npm install
npm WARN saveError ENOENT: no such file or directory, open ‘C:UsersAmoory.SOpackage.json’
npm WARN enoent ENOENT: no such file or directory, open ‘C:UsersAmoory.SOpackage.json’
npm WARN Amoory.SO No description
npm WARN Amoory.SO No repository field.
npm WARN Amoory.SO No README data
npm WARN Amoory.SO No license field.
audited 1553 packages in 2.12s
found 0 vulnerabilities`
npm ERR! A complete log of this run can be found in:
npm ERR! C:Usersmabel.coleAppDataRoamingnpm-cache_logs2019-06-07T19_35_29_33
4Z-debug.log
I am facing the same issue when I run
npm start
from terminal. I got this errornpm ERR! missing script: start npm ERR! A complete log of this run can be found in: npm ERR! /home/niranjan/.npm/_logs/2018-08-24T07_36_58_171Z-debug.log
I am using Ubuntu-16.04
npm ERR! A complete log of this run can be found in:
npm ERR! C:Usersmabel.coleAppDataRoamingnpm-cache_logs2019-06-07T19_35_29_33
4Z-debug.log
i am also facing same problem!plz provide proper solution if nyone knws
am also face same issue am use npm to yarn it,s working now.
I am trying to update angular2-toaster from 3.0 to 8.0. it gives following issue when I run
npm install angular2-toaster@latest —save
follow this command
1.install npm.
2.npm start
You should delete this package-lock.json. sudo rm -rf package-lock.json
Cant see package-lock.json? Try this sudo ls -la
.
Next steps;
1-npm update
2-npm install
3- install your package example: nodejs node_modules/node-sass/scripts/install.js
4- rebuild your package example: npm rebuild node-sass
Необходимо определиться с версией, которая вам нужна. Я предпочитаю ставить не новейшую версию Node.js, а последнюю LTS.
Установка в Elementary OS, Ubuntu:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Установка в Debian:
curl -sL https://deb.nodesource.com/setup_14.x | bash -
apt-get install -y nodejs
Инструкции под разные системы и для разных версий от разработчиков.
Проверка версий:
nodejs -v
npm -v
Если для проекта вы делаете:
npm install
И вылезает ошибка, вроде:
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/.../node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:311:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.3.0-42-generic
gyp ERR! command "/usr/bin/node" "/home/.../node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/.../node_modules/node-sass
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.10.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.10.0 postinstall 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/d1mon/.npm/_logs/2020-03-31T05_52_52_174Z-debug.log
Необходимо удалить каталог node_modules
и файл блокировки package-lock.json
, очистить кэш и пробовать заново:
rm -rf node_modules package-lock.json
npm cache clean --force
npm install
Глобальная установка пакетов
Для глобальной установки пакетов в команду добавляется параметр -g
. Но это не будет работать по умолчанию из-за проблем с правами доступа, поэтому предварительно требуется сделать следующее.
Создадим каталог для глобальных установок:
mkdir ~/.npm-global
Настройка npm на использование нового каталога:
npm config set prefix '~/.npm-global'
В файл ~/.profile
необходимо добавить строку:
export PATH=~/.npm-global/bin:$PATH
В командной строке снова, для применения изменений:
source ~/.profile
На этом все, теперь можно устанавливать пакеты глобально.
When running the npm install
command, sometimes you will have an npm error that causes the install to fail.
The error says the cb()
function is never called as follows:
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nsebhastian/.npm/_logs/2022-06-13T07_08_32_041Z-debug-0.log
The cb()
function mentioned above is a vanilla callback function. The function was used by the npm install
command to mark when an install is completed.
The error means that the installation process was interrupted and left unfinished.
The cause of this error varies from outdated npm
package and cache, a limited memory space, and an incompatible node version.
Here are some things you can try to fix the cb()
never called error:
- Check the
npm
version and cache - Delete the
package-lock.json
file - Check the
strict-ssl
config - Check if you have enough memory for the packages
- Define the
node
version inpackage.json
file (for Heroku)
Let’s see how you can fix the error with the steps above.
Check your npm version and cache
An outdated npm
cache may trigger the error, so you can try to fix the error by clearing the cache.
Run the following command from your terminal:
Once the cache is cleared, run the npm install
command again.
If that doesn’t work, then make sure you are using the latest npm
version. At the time of this writing, the latest npm
version is 8.12.1.
Use the following commands to check and install the latest stable npm
version:
# 👇 check npm version
npm -v
# 👇 install the latest npm version
npm install -g npm@latest
# 👇 if blocked, add sudo command
sudo npm install -g npm@latest
Sometimes, a global installation with the -g
flag may get blocked because of a permission issue.
Add sudo
to perform the installation with admin privileges.
After the npm
is updated, run the npm install
command again.
Delete your package-lock.json file
If you still see the error, then you may need to delete the package-lock.json
file generated in your project directory.
The reason is that npm
generates two different lockfile versions depending on its version.
npm v5 and v6 generated lockfile version 1, and v7 onward generated lockfile version 2.
You can open the package-lock.json
file and see the lockfileVersion
property:
{
"name": "r-app",
"version": "0.1.0",
"lockfileVersion": 2,
// ...
}
Delete the package-lock.json
file and try running the npm install
command again. Some people say it fixed the issue.
Check the strict-ssl configuration
If you have firewall protection on your computer, then the error may appear when npm
do SSL key validation for the install process.
To resolve this error, set the strict-ssl
to false:
npm config set strict-ssl=false
And npm won’t do SSL certificate validation when running installation via https.
Check for your memory space
The npm install
command can generate a node_modules/
folder that is more than 1GB in size.
A React application generated using create-react-app
has a node_modules/
folder that’s around 200MB.
Your local or production environment may not have enough space, so the installation process was interrupted.
It’s not possible to determine the space needed for your node_modules/
folder, so you can only get an estimation.
Try to get at least a few gigabytes of empty space in your computer before running the installation again.
Define the node engines config in package.json
When you see the error on cloud platforms like Heroku and AWS, then it’s possible that the Node.js version used to run the installation is incompatible with your dependencies.
You can specify the node
version required by your application in the package.json
file.
Consider the example below:
{
"name": "example-app",
"description": "My application",
"version": "1.0.0",
"engines": {
"node": "16.x"
}
}
Without specifying the version, cloud platforms will use their own default version. As of this writing, Heroku uses Node v16. Not sure about AWS.
Run the node -v
command to find the node version installed on your computer, then specify the same version in the package.json
file as shown above.
Finally, commit and push the update. See if the issue is resolved.
Conclusion
The above methods are the most relevant fixes for cb()
never called issue.
Sometimes, the error also happens because of a connection timeout, so you can check if you have internet connectivity issues before running the install command again.
Make sure that you can access https://registry.npmjs.org/ from your browser.
If you need more help, you can open a new question on Stack Overflow. Add the detail of your error and mention that you have tried the fixes in this article.
Thanks for reading! 🙏
There’s a bit of a headache going around with respect to global npm permissions. For those of us working on Unix-based systems, it’s not uncommon to come across error messages complaining about your user permissions whenever installing new npm packages, especially when installing them globally.
If errors like the one below look familiar, you’re not alone:
npm WARN checkPermissions Missing write access to /Users/toddbirchard/.npm-packages/lib/node_modules
npm ERR! path /Users/toddbirchard/.npm-packages/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/toddbirchard/.npm-packages/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/Users/toddbirchard/.npm-packages/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access '/Users/toddbirchard/.npm-packages/lib/node_modules'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/Users/toddbirchard/.npm-packages/lib/node_modules' }
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 (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/toddbirchard/.npm/_logs/2019-05-05T20_36_45_642Z-debug.log
This is a textbook case of being trigger-happy with the sudo
command. If you’re installing npm as a user other than root, it’s a bad idea to install Node + npm with the sudo
command. If a non-root user installs dependencies by escalating privileges via sudo
, the installation will appear to succeed. However, we’ve just created a scenario where the user in question does not have permission to modify global npm the user just installed (nor modify/install packages). When we installed Node/NPM with sudo
, we handed exclusive ownership to the root user. That would mean we’d have to specify sudo
before every global package install, which is annoying but more importantly unrealistic.
It gets worse. Npm packages that require post-install scripts to be run simply become impossible to install. Sometimes you might be able to get away with the following, but only if the scripts aren’t necessary:
$ npm i -g [package-name] --ignore-scripts
When the scripts are necessary, like in the case of node-sass
, we’re shit outta luck. Using the --ignore-scripts
flag just results in a broken install. Attempting to install using sudo
looks like this:
$ sudo npm i -g node-sass
[sudo] password for todd:
/home/todd/.npm-global/bin/node-sass -> /home/todd/.npm-global/lib/node_modules/node-sass/bin/node-sass
Uh oh….
Unable to save binary /home/todd/.npm-global/lib/node_modules/node-sass/vendor/linux-x64-64 : { Error: EACCES: permission denied, mkdir '/home/todd/.npm-global/lib/node_modules/node-sass/vendor'
at Object.mkdirSync (fs.js:753:3)
at sync (/home/todd/.npm-global/lib/node_modules/node-sass/node_modules/mkdirp/index.js:71:13)
at Function.sync (/home/todd/.npm-global/lib/node_modules/node-sass/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/home/todd/.npm-global/lib/node_modules/node-sass/scripts/install.js:114:11)
at Object.<anonymous> (/home/todd/.npm-global/lib/node_modules/node-sass/scripts/install.js:157:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
errno: -13,
syscall: 'mkdir',
code: 'EACCES',
path: '/home/todd/.npm-global/lib/node_modules/node-sass/vendor' }
> node-sass@4.12.0 postinstall /home/todd/.npm-global/lib/node_modules/node-sass
> node scripts/build.js
Building: /usr/bin/node /home/todd/.npm-global/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/bin/node',
gyp verb cli '/home/todd/.npm-global/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using node-gyp@3.8.0
gyp info using node@10.15.2 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/bin/python2
gyp verb check python version `/usr/bin/python2 -c "import sys; print "2.7.15
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 10.15.2
gyp verb command install [ '10.15.2' ]
gyp verb install input version string "10.15.2"
gyp verb install installing version: 10.15.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 10.15.2
gyp verb build dir attempting to create "build" dir: /home/todd/.npm-global/lib/node_modules/node-sass/build
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/todd/.npm-global/lib/node_modules/node-sass/build'
gyp ERR! System Linux 4.15.0-43-generic
gyp ERR! command "/usr/bin/node" "/home/todd/.npm-global/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/todd/.npm-global/lib/node_modules/node-sass
gyp ERR! node -v v10.15.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.12.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.12.0 postinstall 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/todd/.npm/_logs/2019-05-05T20_52_06_518Z-debug.log
Why does this happen? Because by default, the post-install scripts attempt to run as the current user. Since the current user doesn’t have permissions to mess with packages installed globally, the installation ultimately fails. To fix this, we need to reinstall Node the correct way.
Reinstalling Node
I’m working under the assumption that we’re using Ubuntu or a Debian-based Linux distro. The first thing we need to do is remove Node:
$ apt remove node
$ apt remove nodejs
Verify that Node is gone:
$ which node
If a folder path is returned by the above, nuke it. That should leave us ready for a fresh install.
Since we’re on a Debian system, we need to install Node via Nodesource. I’d recommend running this in the /tmp
folder, or wherever you like to dump things saved from the internet:
$ curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
$ apt-get install -y nodejs
Now would be a good time to get the latest npm as well:
$ npm i -g npm@latest
When the installation is complete, check to see if everything worked:
$ node -v
> v16.13.0
$ npm -v
>> 8.12.1
Create a New Global NPM Directory
With Node reinstalled, we can move on to creating and configuring a new directory to hold our global npm modules. You can name this what you want, but it’s generally recommended to name this npm-global
or something of the sort. Don’t use sudo
!
$ mkdir ~/.npm-global
Now we can configure npm to recognize this folder:
$ npm config set prefix '~/.npm-global'
Next, we need to add this to our PATH. This should go in ~/.bashrc
(or ~/.bash_profile
, depending on which you use):
$ echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
$ source ~/.bashrc
You Did Good
That should do it! From now on, remember to stray away from using sudo
when installing Node, npm, or even modifying npm packages. The npm documentation explicitly recommends against this, but it’s all good. We all make mistakes.
Engineer with an ongoing identity crisis. Breaks everything before learning best practices. Completely normal and emotionally stable.
Support us
We started sharing these tutorials to help and inspire new scientists and engineers around the world. If Hackers and Slackers has been helpful to you, feel free to buy us a coffee to keep us going :).
Post Views: 60
Error:-
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
[webpack-cli] Error: Unknown option '--hide-modules'
[webpack-cli] Run 'webpack --help' to see available commands and options
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ development 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! C:UsersCotocus5AppDataRoamingnpm-cache_logs21-08-12T12_23_56_189Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev 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! C:UsersCotocus5AppDataRoamingnpm-cache_logs21-08-12T12_23_56_273Z-debug.log
Solution:-
Step 1:- Run this command to verify cache
npm cache verify
Step 2:- Recheck your package.json and webpack.mix.js file it is correct or not.
Step 3:- Then Delete the Node Module file which is present in your project folder.
Step 4:- Run the Npm install command.
npm install
Step 5:- Then Run npm run dev command.
npm run dev
- Author
- Recent Posts
Tagged : npm / NPM error / npm error issue / npm run dev issue / npm run dev problem