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
npmandnpm-cachein...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 installnpm 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.2k21 gold badges79 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.2k21 gold badges79 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
nodemodulesandpackage-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 installandnpm 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
91412 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 startfrom 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.logI 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
На этом все, теперь можно устанавливать пакеты глобально.

The npm ERR! code 1 error usually occurs when you run the npm install command.
This cause of this error is that one of the dependencies you define in your package.json file fails to be installed properly on your computer.
The error message log looks as follows:
$ npm install
npm ERR! code 1
npm ERR! path /n-app/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
...
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! .npm/_logs/2022-06-24T03_37_26_246Z-debug-0.log
In the example above, you can see that there is an npm ERR! path... defined right below the code 1 log:
$ npm install
npm ERR! code 1
npm ERR! path /n-app/node_modules/node-sass
This means that npm fails to install the node-sass module that’s added as a dependency to the n-app project.
To resolve this error, you need to upgrade the dependency module that causes the error.
Let’s learn how to fix this error next.
Fix npm error code 1 by updating your dependencies
Here’s the package.json file of the n-app project:
{
"name": "n-app",
"version": "1.0.0",
"dependencies": {
"axios": "^0.10.2",
"node-sass": "^4.14.1",
"webpack": "^4.0.0"
}
}
As you can see, there’s a dependency to the node-sass module version 4.14.1 in my project.
When looking into the node-sass documentation, I found that there’s a table showing the Node versions supported by the package:
Since I have Node v16.15.1 on my computer, this means I must use node-sass v6.0+ to resolve the issue.
Update the node-sass dependency to the latest version:
{
"dependencies": {
"axios": "^0.10.2",
"node-sass": "^7.0.1",
"webpack": "^4.0.0"
}
}
Then run npm install again. This time, the dependencies are installed without any error:
$ npm install
added 307 packages, and audited 308 packages in 50s
found 0 vulnerabilities
It’s always recommended to update all your dependency packages to the latest version to avoid compatibility issues with Node.
You can use npm-check-updates to help you with updating the dependencies:
# 👇 check your package.json for dependency updates
npx npm-check-updates
# 👇 write newer version in package.json
npx npm-check-updates -u
# 👇 install the latest version
npm install
If you don’t want to update all dependencies at once, you can update them one by one using the npx npm-check-updates output as a reference.
For example, here’s the output for n-app project:
$ npx npm-check-updates
Checking /n-app/package.json
[====================] 3/3 100%
axios ^0.21.2 → ^0.27.2
node-sass ^4.0.1 → ^7.0.1
webpack ^4.73.0 → ^5.73.0
Run npx npm-check-updates -u to upgrade package.json
Using the output above:
- Update one package version in
package.jsonfile - Then run
npm install - Make sure your application runs perfectly and pass all tests
Repeat the steps above until you have all package versions updated.
Fix npm error code 1 by downgrading Node (not recommended)
The other way to fix the issue is to downgrade your Node.js version.
In the example above, there are specific Node.js versions supported by specific node-sass versions. You need to make sure that you are using the Node version supported by your module.
This fix is not ideal because you may have other module with compatibility issues once you downgrade Node.
The best way to solve the issue is by updating Node.js and all your dependencies to the latest stable version as explained above.
And that’s how you fix the npm error code 1 issue in your project.
|
0 / 0 / 0 Регистрация: 15.02.2019 Сообщений: 1 |
|
|
1 |
|
|
08.05.2020, 11:04. Показов 7347. Ответов 1
При вводе команды: npm ERR! A complete log of this run can be found in:
__________________
0 |
|
kidASM 355 / 255 / 102 Регистрация: 28.08.2013 Сообщений: 576 |
||||
|
08.05.2020, 23:40 |
2 |
|||
|
В файле «package.json» добавь/измени
0 |
|
IT_Exp Эксперт 87844 / 49110 / 22898 Регистрация: 17.06.2006 Сообщений: 92,604 |
08.05.2020, 23:40 |
|
2 |
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.logThis 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-scriptsWhen 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-sassUh 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.logWhy 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 nodejsVerify that Node is gone:
$ which nodeIf 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 nodejsNow would be a good time to get the latest npm as well:
$ npm i -g npm@latestWhen the installation is complete, check to see if everything worked:
$ node -v
> v16.13.0$ npm -v
>> 8.12.1Create 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-globalNow 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 ~/.bashrcYou 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 :).
-
#1
Пытаюсь установить готовый и запустить готовый приложение на Node JS, Angular JS
Выводится в консоле такая ошибка
Код:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: banshop@0.0.0
npm ERR! Found: @typescript-eslint/parser@5.18.0
npm ERR! node_modules/@typescript-eslint/parser
npm ERR! dev @typescript-eslint/parser@"^5.15.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @typescript-eslint/parser@"~5.10.0" from @nrwl/eslint-plugin-nx@13.9.3
npm ERR! node_modules/@nrwl/eslint-plugin-nx
npm ERR! dev @nrwl/eslint-plugin-nx@"13.9.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:UserssanabAppDataLocalnpm-cacheeresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:UserssanabAppDataLocalnpm-cache_logs2022-04-09T19_28_10_865Z-debug-0.log
-
#2
C:UserssanabAppDataLocalnpm-cache_logs2022-04-09T19_28_10_865Z-debug-0.log
Что там?
-
#3
C:UserssanabAppDataLocalnpm-cache_logs2022-04-09T19_28_10_865Z-debug-0.log
Что там?
Bash:
0 verbose cli [
0 verbose cli 'C:\Program Files\nodejs\node.exe',
0 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
0 verbose cli 'install'
0 verbose cli ]
1 info using npm@8.5.0
2 info using node@v16.14.2
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:C:Program Filesnodejsnode_modulesnpmnpmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:UserssanabDesktopDIPLOMA.npmrc Completed in 0ms
10 timing config:load:project Completed in 3ms
11 timing config:load:file:C:Userssanab.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:UserssanabAppDataRoamingnpmetcnpmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 10ms
19 timing npm:load:configload Completed in 10ms
20 timing npm:load:setTitle Completed in 0ms
21 timing config:load:flatten Completed in 2ms
22 timing npm:load:display Completed in 3ms
23 verbose logfile C:UserssanabAppDataLocalnpm-cache_logs2022-04-09T20_01_15_289Z-debug-0.log
24 timing npm:load:logFile Completed in 6ms
25 timing npm:load:timers Completed in 0ms
26 timing npm:load:configScope Completed in 0ms
27 timing npm:load Completed in 20ms
28 timing arborist:ctor Completed in 0ms
29 silly logfile start cleaning logs, removing 2 files
30 timing arborist:ctor Completed in 0ms
31 timing idealTree:init Completed in 12ms
32 timing idealTree:userRequests Completed in 0ms
33 silly idealTree buildDeps
34 silly fetch manifest @angular/animations@^13.3.0
35 http fetch GET 200 https://registry.npmjs.org/@angular%2fanimations 347ms (cache revalidated)
36 silly fetch manifest @angular/core@^13.3.0
37 http fetch GET 200 https://registry.npmjs.org/@angular%2fcore 137ms (cache revalidated)
38 silly fetch manifest rxjs@~7.4.0
39 http fetch GET 200 https://registry.npmjs.org/rxjs 6ms (cache hit)
40 silly fetch manifest zone.js@~0.11.5
41 http fetch GET 200 https://registry.npmjs.org/zone.js 112ms (cache revalidated)
42 silly fetch manifest @angular/cdk@^13.3.0
43 http fetch GET 200 https://registry.npmjs.org/@angular%2fcdk 120ms (cache revalidated)
44 silly fetch manifest @angular/common@^13.3.0
45 http fetch GET 200 https://registry.npmjs.org/@angular%2fcommon 111ms (cache revalidated)
46 silly fetch manifest @angular/compiler@^13.3.0
47 http fetch GET 200 https://registry.npmjs.org/@angular%2fcompiler 118ms (cache revalidated)
48 silly fetch manifest @angular/forms@^13.3.0
49 http fetch GET 200 https://registry.npmjs.org/@angular%2fforms 158ms (cache revalidated)
50 silly fetch manifest @angular/platform-browser@^13.3.0
51 http fetch GET 200 https://registry.npmjs.org/@angular%2fplatform-browser 134ms (cache revalidated)
52 silly fetch manifest @angular/localize@^13.3.0
53 http fetch GET 200 https://registry.npmjs.org/@angular%2flocalize 967ms (cache revalidated)
54 silly fetch manifest @angular/compiler-cli@^13.3.0
55 http fetch GET 200 https://registry.npmjs.org/@angular%2fcompiler-cli 113ms (cache revalidated)
56 silly fetch manifest typescript@~4.5.5
57 http fetch GET 200 https://registry.npmjs.org/typescript 12ms (cache hit)
58 silly fetch manifest @angular/material@^13.3.0
59 http fetch GET 200 https://registry.npmjs.org/@angular%2fmaterial 120ms (cache revalidated)
60 silly fetch manifest @angular/platform-browser-dynamic@^13.3.0
61 http fetch GET 200 https://registry.npmjs.org/@angular%2fplatform-browser-dynamic 108ms (cache revalidated)
62 silly fetch manifest @angular/platform-server@^13.3.0
63 http fetch GET 200 https://registry.npmjs.org/@angular%2fplatform-server 155ms (cache revalidated)
64 silly fetch manifest @angular/router@^13.3.0
65 http fetch GET 200 https://registry.npmjs.org/@angular%2frouter 150ms (cache revalidated)
66 silly fetch manifest @ngrx/component-store@^13.0.2
67 http fetch GET 200 https://registry.npmjs.org/@ngrx%2fcomponent-store 1067ms (cache revalidated)
68 silly fetch manifest @ngrx/effects@^13.0.2
69 http fetch GET 200 https://registry.npmjs.org/@ngrx%2feffects 122ms (cache revalidated)
70 silly fetch manifest @ngrx/store@^13.0.2
71 http fetch GET 200 https://registry.npmjs.org/@ngrx%2fstore 240ms (cache revalidated)
72 silly fetch manifest @ngrx/entity@^13.0.2
73 http fetch GET 200 https://registry.npmjs.org/@ngrx%2fentity 215ms (cache revalidated)
74 silly fetch manifest @ngrx/router-store@^13.0.2
75 http fetch GET 200 https://registry.npmjs.org/@ngrx%2frouter-store 124ms (cache revalidated)
76 silly fetch manifest @nguniversal/express-engine@^13.0.2
77 http fetch GET 200 https://registry.npmjs.org/@nguniversal%2fexpress-engine 1085ms (cache revalidated)
78 silly fetch manifest express@^4.17.3
79 http fetch GET 200 https://registry.npmjs.org/express 105ms (cache revalidated)
80 silly fetch manifest @nrwl/angular@13.9.3
81 http fetch GET 200 https://registry.npmjs.org/@nrwl%2fangular 138ms (cache revalidated)
82 silly fetch manifest angular-imask@^6.4.2
83 http fetch GET 200 https://registry.npmjs.org/angular-imask 778ms (cache revalidated)
84 silly fetch manifest compression@^1.7.4
85 http fetch GET 200 https://registry.npmjs.org/compression 116ms (cache revalidated)
86 silly fetch manifest hammerjs@^2.0.8
87 http fetch GET 200 https://registry.npmjs.org/hammerjs 115ms (cache revalidated)
88 silly fetch manifest tslib@^2.3.1
89 http fetch GET 200 https://registry.npmjs.org/tslib 4ms (cache hit)
90 silly fetch manifest @angular-builders/custom-webpack@^13.1.0
91 http fetch GET 200 https://registry.npmjs.org/@angular-builders%2fcustom-webpack 1528ms (cache revalidated)
92 silly fetch manifest @angular-devkit/build-angular@^13.3.0
93 http fetch GET 200 https://registry.npmjs.org/@angular-devkit%2fbuild-angular 119ms (cache revalidated)
94 silly fetch manifest @angular/service-worker@^13.0.0 || ^13.3.0-rc.0
95 http fetch GET 200 https://registry.npmjs.org/@angular%2fservice-worker 1029ms (cache revalidated)
96 silly fetch manifest karma@^6.3.0
97 http fetch GET 200 https://registry.npmjs.org/karma 112ms (cache revalidated)
98 silly fetch manifest ng-packagr@^13.0.0
99 http fetch GET 200 https://registry.npmjs.org/ng-packagr 110ms (cache revalidated)
100 silly fetch manifest protractor@^7.0.0
101 http fetch GET 200 https://registry.npmjs.org/protractor 113ms (cache revalidated)
102 silly fetch manifest tailwindcss@^2.0.0 || ^3.0.0
103 http fetch GET 200 https://registry.npmjs.org/tailwindcss 130ms (cache revalidated)
104 silly fetch manifest autoprefixer@^10.0.2
105 http fetch GET 200 https://registry.npmjs.org/autoprefixer 118ms (cache revalidated)
106 silly fetch manifest postcss@^8.1.0
107 http fetch GET 200 https://registry.npmjs.org/postcss 90ms (cache revalidated)
108 silly fetch manifest @angular-eslint/eslint-plugin@^13.1.0
109 http fetch GET 200 https://registry.npmjs.org/@angular-eslint%2feslint-plugin 134ms (cache revalidated)
110 silly fetch manifest eslint@^8.11.0
111 http fetch GET 200 https://registry.npmjs.org/eslint 5ms (cache hit)
112 silly fetch manifest @angular-eslint/eslint-plugin-template@^13.1.0
113 http fetch GET 200 https://registry.npmjs.org/@angular-eslint%2feslint-plugin-template 118ms (cache revalidated)
114 silly fetch manifest @angular-eslint/template-parser@^13.1.0
115 http fetch GET 200 https://registry.npmjs.org/@angular-eslint%2ftemplate-parser 120ms (cache revalidated)
116 silly fetch manifest @angular/cli@^13.3.0
117 http fetch GET 200 https://registry.npmjs.org/@angular%2fcli 151ms (cache revalidated)
118 silly fetch manifest @angular/language-service@^13.3.0
119 http fetch GET 200 https://registry.npmjs.org/@angular%2flanguage-service 108ms (cache revalidated)
120 silly fetch manifest @ngrx/schematics@^13.0.2
121 http fetch GET 200 https://registry.npmjs.org/@ngrx%2fschematics 142ms (cache revalidated)
122 silly fetch manifest @ngrx/store-devtools@^13.0.2
123 http fetch GET 200 https://registry.npmjs.org/@ngrx%2fstore-devtools 139ms (cache revalidated)
124 silly fetch manifest @nguniversal/builders@^13.0.2
125 http fetch GET 200 https://registry.npmjs.org/@nguniversal%2fbuilders 1708ms (cache revalidated)
126 silly fetch manifest @nrwl/cli@13.9.3
127 http fetch GET 200 https://registry.npmjs.org/@nrwl%2fcli 7ms (cache hit)
128 silly fetch manifest @nrwl/cypress@13.9.3
129 http fetch GET 200 https://registry.npmjs.org/@nrwl%2fcypress 154ms (cache revalidated)
130 silly fetch manifest cypress@^9.5.2
131 http fetch GET 200 https://registry.npmjs.org/cypress 127ms (cache revalidated)
132 silly fetch manifest @nrwl/eslint-plugin-nx@13.9.3
133 http fetch GET 200 https://registry.npmjs.org/@nrwl%2feslint-plugin-nx 137ms (cache revalidated)
134 silly fetch manifest @typescript-eslint/parser@^5.15.0
135 http fetch GET 200 https://registry.npmjs.org/@typescript-eslint%2fparser 130ms (cache revalidated)
136 silly fetch manifest @typescript-eslint/parser@~5.10.0
137 timing idealTree Completed in 13819ms
138 timing command:install Completed in 13829ms
139 verbose stack Error: unable to resolve dependency tree
139 verbose stack at Arborist.[failPeerConflict] (C:Program Filesnodejsnode_modulesnpmnode_modules@npmcliarboristlibarboristbuild-ideal-tree.js:1399:25)
139 verbose stack at Arborist.[loadPeerSet] (C:Program Filesnodejsnode_modulesnpmnode_modules@npmcliarboristlibarboristbuild-ideal-tree.js:1365:34)
139 verbose stack at async Arborist.[buildDepStep] (C:Program Filesnodejsnode_modulesnpmnode_modules@npmcliarboristlibarboristbuild-ideal-tree.js:951:11)
139 verbose stack at async Arborist.buildIdealTree (C:Program Filesnodejsnode_modulesnpmnode_modules@npmcliarboristlibarboristbuild-ideal-tree.js:215:7)
139 verbose stack at async Promise.all (index 1)
139 verbose stack at async Arborist.reify (C:Program Filesnodejsnode_modulesnpmnode_modules@npmcliarboristlibarboristreify.js:152:5)
139 verbose stack at async Install.exec (C:Program Filesnodejsnode_modulesnpmlibcommandsinstall.js:157:5)
139 verbose stack at async module.exports (C:Program Filesnodejsnode_modulesnpmlibcli.js:66:5)
140 verbose cwd C:UserssanabDesktopDIPLOMA
141 verbose Windows_NT 10.0.22000
142 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
143 verbose node v16.14.2
144 verbose npm v8.5.0
145 error code ERESOLVE
146 error ERESOLVE unable to resolve dependency tree
147 error
148 error While resolving: [1mbanshop[22m@[1m0.0.0[22m
148 error Found: [1m@typescript-eslint/parser[22m@[1m5.18.0[22m[2m[22m
148 error [2mnode_modules/@typescript-eslint/parser[22m
148 error [33mdev[39m [1m@typescript-eslint/parser[22m@"[1m^5.15.0[22m" from the root project
148 error
148 error Could not resolve dependency:
148 error [35mpeer[39m [1m@typescript-eslint/parser[22m@"[1m~5.10.0[22m" from [1m@nrwl/eslint-plugin-nx[22m@[1m13.9.3[22m[2m[22m
148 error [2mnode_modules/@nrwl/eslint-plugin-nx[22m
148 error [33mdev[39m [1m@nrwl/eslint-plugin-nx[22m@"[1m13.9.3[22m" from the root project
148 error
148 error Fix the upstream dependency conflict, or retry
148 error this command with --force, or --legacy-peer-deps
148 error to accept an incorrect (and potentially broken) dependency resolution.
148 error
148 error See C:UserssanabAppDataLocalnpm-cacheeresolve-report.txt for a full report.
149 verbose exit 1
150 timing npm Completed in 14063ms
151 verbose unfinished npm timer reify 1649534475513
152 verbose unfinished npm timer reify:loadTrees 1649534475521
153 verbose unfinished npm timer idealTree:buildDeps 1649534475534
154 verbose unfinished npm timer idealTree:#root 1649534475534
155 verbose code 1
156 error A complete log of this run can be found in:
156 error C:UserssanabAppDataLocalnpm-cache_logs2022-04-09T20_01_15_289Z-debug-0.log
-
#4
Если коротко то мне надо запустить вот это
https://github.com/Fafnur/banshop
-
#5
npm install --legacy-peer-deps
The npm error “npm ERR! Missing script: “start”” happens when npm can’t find a script called “start” in your package.json file. This can either be because you’re not in the same directory as the package.json file when you ran npm start or because package.json does not contain a script called “start”. Fix this by ensuring you’re in the right directory or by adding a “start” script to package.json.
Scripts in Node modules are defined in the package.json file under the property “scripts”. You can run each of these scripts with npm <script>, where <script> is the name of the script you want to run. Usually, the script that’s defined is just a one-liner command, but theoretically, you could have a full-blown script in there. I wouldn’t recommend it though.
Here’s an example of some scripts that are present in package.json by default when you create a project with create-react-app:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
As you can see, they’re just one-liner commands that call another script, react-scripts, with a single argument of what you want to do.
So how do you get into a situation where npm can’t find the script “start”?
❌ Problem: you’re not in the same directory as package.json
The first and most obvious cause of this error is that you’re not in the right directory. This can be easy to do especially after running create-react-app. I did this just the other day, in fact. I first ran npx create-react-app my-react-app, then immediately ran npm start. Problem is, the create-react-app script makes a new directory in the current directory called whatever you named your app. So, in my case, it was called my-react-app. In there is a whole other package.json file that does contain a “start” script.
Here’s what happened when I tried to run npm start from the wrong directory:
npm ERR! Missing script: "start" npm ERR! npm ERR! Did you mean one of these? npm ERR! npm star # Mark your favorite packages npm ERR! npm stars # View packages marked as favorites npm ERR! npm ERR! To see a list of scripts, run: npm ERR! npm run npm ERR! A complete log of this run can be found in: npm ERR! /home/user/.npm/_logs/2022-04-24T19_13_03_518Z-debug-0.log
You can go check the log, but it’s not necessary. We already know what the problem is.
✅ Fix: change to the directory containing package.json
All we need to do in this situation is cd to the correct directory. Again, in my case, that directory is called my-react-app and it contains the package.json file with the “start” script defined in it.
Here’s all I did:
Then I ran the npm command again:
And, after doing this, it started right up:
Compiled successfully! You can now view my-react-app in the browser. Local: http://localhost:3000 On Your Network: http://192.168.2.3:3000 Note that the development build is not optimized. To create a production build, use npm run build. webpack compiled successfully
And that’s all there is to it!
❌ Problem: your package.json doesn’t have a “start” script defined
If you actually don’t have the “start” script definied in your package.json file, then you have bigger problems than simply being in the wrong directory. Theres a few potential causes for this:
- you don’t have
create-react-appinstalled - you didn’t use
create-react-appto make this app
Of course, both can be true at the same time as well.
So, assuming you got this error due to trying to use create-react-app, let’s push forward with a solution to this.
✅ Fix: install create-react-app and create an app with it first
If we don’t have create-react-app or didn’t use it yet, the solution to this is simple as doing so.
We can first install create-react-app with the following command:
npm install create-react-app
This will give us the create-react-app Node package which we can then use to make our React app that has a “start” script already defined in package.json.
Once we have it installed, we can create our React app with:
npx create-react-app <name of your app>
Here, all we are doing is calling the create-react-app script that we just installed.
You might be wondering what npx is here; it’s simply a way to execute commands that were installed with npm without having to modify our $PATH variable to point to the node_modules/bin directory in our current working directory. That would be super annoying to have to do that every time.
Now, you need to switch to the newly created directory and then run npm start. Otherwise you’ll be in the same situation as our previous “problem” example 😉
cd <name of your app> && npm start
That should do the trick.
Conclusion
In this article we talked about the various causes of “[Solved] npm ERR! Missing script: “start”” and how to fix them. The only root cause of this error is that npm can’t find a package.json file in the current working directory with a “start” script defined. The causes of this root cause can be a number of things. Most commonly, though, is that you’re just not in the right directory. Fix this by switching to the directory that contains the package.json file. Otherwise, it’s possible that your package.json file just doesn’t have a “start” script defined in it. This is usually the case when you’re trying to use create-react-app. Simply install the tool first, create the app, then try again.
That’s all for now, hope it helps.
TL;DR
This solution works for Node v16.13.0 and NPM v8.1.3
Introduction
I don’t always hate working using NPM unless it starts downloading tons of node_modules and giving not so verbose logs. Today, my colleague and I found an NPM login bug that’s not so interesting and hard to debug. It takes me about an hour to find out what is the root cause.
In this article, I will write the solution just in case you meet the same issue.
Current Condition
In my current company, we use Nexus3 as our private repository for the NPM module. I also use Node v12.22.4 and NPM v8.1.3 for working on my local machine. To login into our Nexus repository, I use .npmrc with this format:
|
|
And we’re happy with it. No issue.
The Issue
The issue comes when my colleague wants to try using Node v16.13.0. When the npm i @myorg/utils command is executed, it starts saying 401.
|
|
Finding a Solution
I wonder if it’s the Nexus 3 is not compatible with the Node v16 or what. So I tried to re-login to the Nexus repository.
|
|
Okay, now we’re logged in. But as soon as I check using npm whoami, it said 401 again.
|
|
Then I check my .npmrc file content, turns out Node v16 has a different format of .npmrc. Here is my current .npmrc file content:
|
|
What a strange format. It doesn’t reflect the scope, also I am still confused with the _authToken format itself. Of course, as a good developer, we need a fast hand for searching every keyword on google for our bugs. And then, I found this comment by @apottere. So, I tried to rewrite my .npmrc file content manually. This is my current .npmrc file content:
|
|
Seems promising, so I tried again to execute npm i @myorg/utils again. And it failed.
|
|
Yep, not found. I thought it was because the scope isn’t reflected in the .npmrc file.
The Solution
So I tried using the old way, rewriting the content manually. This is my current and final .npmrc file content:
|
|
Lastly, I tried again the npm i @myorg/utils command and it worked.
|
|
Conclusion
So, It was the npm login command all along. I still can’t find the whole documentation about the new .npmrc format, I might miss the docs, or maybe there isn’t one. If you have the same issue, I hope you find this article and can fix the issue.
Thank you for reading!
Any kind of supports is greatly appreciated! Kindly support me via Bitcoin, Ko-fi, Trakteer, or just continue to read another content. You can write a response via Webmention and let me know the URL via Telegraph.