Error command npm run build exited with 126

I built an app using React.js and it ran fine on the local server. But when I publish on Vercel, this error happens. How can I solve this? sh: /vercel/path0/node_modules/.bin/react-scripts: Permiss...

0

I built an app using React.js and it ran fine on the local server. But when I publish on Vercel, this error happens. How can I solve this?

sh: /vercel/path0/node_modules/.bin/react-scripts: Permission denied
Error: Command "npm run build" exited with 126

The error screenshot

  • reactjs
  • web
  • deployment
  • vercel

Improve this question

edited Jan 21 at 0:28

achen20

asked Jan 20 at 22:07

achen20's user avatar

achen20achen20

52 bronze badges

0

Add a comment
 | 

Sorted by:

Reset to default

Your Answer

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Post as a guest

Name

Email

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged

  • reactjs
  • web
  • deployment
  • vercel

or ask your own question.

Contents of npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ ‘C:Program Filesnodejsnode.exe’,
1 verbose cli ‘C:Program Filesnodejsnode_modulesnpmbinnpm-cli.js’,
1 verbose cli ‘run-script’,
1 verbose cli ‘start’ ]
2 info using npm@3.6.0
3 info using node@v5.7.1
4 verbose run-script [ ‘prestart’, ‘start’, ‘poststart’ ]
5 info lifecycle redux-boilerplate@0.0.0prestart: redux-boilerplate@0.0.0
6 silly lifecycle redux-boilerplate@0.0.0prestart: no script for prestart, continuing
7 info lifecycle redux-boilerplate@0.0.0start: redux-boilerplate@0.0.0
8 verbose lifecycle redux-boilerplate@0.0.0start: unsafe-perm in lifecycle true
9 verbose lifecycle redux-boilerplate@0.0.0start: PATH: C:Program Filesnodejsnode_modulesnpmbinnode-gyp-bin;c:_projectsphp55redux-boilerplatenode_modules.bin;C:ProgramDataOracleJavajavapath;C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;C:Program FilesHewlett-PackardSimplePass;C:Program Files (x86)Gitcmd;C:Program Files (x86)Gitbin;c:wampbinphpphp5.5.12;C:ProgramDataComposerSetupbin;c:_projectsotherbin;c:wampbinmysqlmysql5.6.17bin;c:Program Files7-Zip;c:UsersVladislavAppDataRoamingComposervendorbin;C:Program Files (x86)SkypePhone;C:Program Files (x86)Vagrantbin;C:Program Filesnodejs;c:Program FilesIntelWiFibin;c:Program FilesCommon FilesIntelWirelessCommon;C:UsersVladislavAppDataRoamingnpm
10 verbose lifecycle redux-boilerplate@0.0.0start: CWD: c:_projectsphp55redux-boilerplate
11 silly lifecycle redux-boilerplate@0.0.0start: Args: [ ‘/d /s /c’, ‘ENV=development node dev.server.js’ ]
12 silly lifecycle redux-boilerplate@0.0.0start: Returned: code: 126 signal: null
13 info lifecycle redux-boilerplate@0.0.0~start: Failed to exec start script
14 verbose stack Error: redux-boilerplate@0.0.0 start: ENV=development node dev.server.js
14 verbose stack Exit status 126
14 verbose stack at EventEmitter. (C:Program Filesnodejsnode_modulesnpmlibutilslifecycle.js:232:16)
14 verbose stack at emitTwo (events.js💯13)
14 verbose stack at EventEmitter.emit (events.js:185:7)
14 verbose stack at ChildProcess. (C:Program Filesnodejsnode_modulesnpmlibutilsspawn.js:24:14)
14 verbose stack at emitTwo (events.js💯13)
14 verbose stack at ChildProcess.emit (events.js:185:7)
14 verbose stack at maybeClose (internal/child_process.js:827:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid redux-boilerplate@0.0.0
16 verbose cwd c:_projectsphp55redux-boilerplate
17 error Windows_NT 10.0.10586
18 error argv «C:Program Filesnodejsnode.exe» «C:Program Filesnodejsnode_modulesnpmbinnpm-cli.js» «run-script» «start»
19 error node v5.7.1
20 error npm v3.6.0
21 error code ELIFECYCLE
22 error redux-boilerplate@0.0.0 start: ENV=development node dev.server.js
22 error Exit status 126
23 error Failed at the redux-boilerplate@0.0.0 start script ‘ENV=development node dev.server.js’.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the redux-boilerplate package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error ENV=development node dev.server.js
23 error You can get information on how to open an issue for this project with:
23 error npm bugs redux-boilerplate
23 error Or if that isn’t available, you can get their info via:
23 error npm owner ls redux-boilerplate
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

So im working through a course on Pluralsight which has with a folder containing files required for the course. Part of the course requires me to install and run npm. It installed with a few issue, which required me to run npm audit fix. The dependency issues cleared but Im still having issues running npm start. Below is the console’s response after running npm start and after that, separated by hash tags is a copy of the log output. Has anyone come across this and/or could anyone help with this?

###################################################
s/demos$ npm start

> html5-fundamentals@1.0.0 start /Users/briensmarandache/Atom_Projects/Pluralsight/HTML5/html5-fundamentals/demos
> http-server -o

sh: /Users/briensmarandache/Atom_Projects/Pluralsight/HTML5/html5-fundamentals/demos/node_modules/.bin/http-server: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! html5-fundamentals@1.0.0 start: `http-server -o`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the html5-fundamentals@1.0.0 start 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!     /Users/briensmarandache/.npm/_logs/2019-04-23T22_39_37_214Z-debug.log

###################################################
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@6.4.1
3 info using node@v10.15.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle html5-fundamentals@1.0.0~prestart: html5-fundamentals@1.0.0
6 info lifecycle html5-fundamentals@1.0.0~start: html5-fundamentals@1.0.0
7 verbose lifecycle html5-fundamentals@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle html5-fundamentals@1.0.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/briensmarandache/Atom_Projects/Pluralsight/HTML5/html5-fundamentals/demos/node_modules/.bin:/Users/briensmarandache/.rbenv/shims:/Users/briensmarandache/.rbenv/bin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
9 verbose lifecycle html5-fundamentals@1.0.0~start: CWD: /Users/briensmarandache/Atom_Projects/Pluralsight/HTML5/html5-fundamentals/demos
10 silly lifecycle html5-fundamentals@1.0.0~start: Args: [ '-c', 'http-server -o' ]
11 silly lifecycle html5-fundamentals@1.0.0~start: Returned: code: 126  signal: null
12 info lifecycle html5-fundamentals@1.0.0~start: Failed to exec start script
13 verbose stack Error: html5-fundamentals@1.0.0 start: `http-server -o`
13 verbose stack Exit status 126
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid html5-fundamentals@1.0.0
15 verbose cwd /Users/briensmarandache/Atom_Projects/Pluralsight/HTML5/html5-fundamentals/demos
16 verbose Darwin 18.5.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v10.15.3
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 126
22 error html5-fundamentals@1.0.0 start: `http-server -o`
22 error Exit status 126
23 error Failed at the html5-fundamentals@1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]

Содержание

  1. Error: Command «npm run build» exited with 1 #6515
  2. <>’s edit
  3. Area: Vercel CLI Name: arduinoprojectportugal Previous Page: Not Specified
  4. React App Web site created using create-react-app my-ppa.vercel.app
  5. npm run build exited with return -1 #126
  6. Comments
  7. Footer
  8. «npm install» exited with code -1 on dotnet publish #9593
  9. Comments
  10. Steps to reproduce
  11. Expected behavior
  12. Actual behavior
  13. Additional info
  14. Environment data
  15. Команда «npm run build — —prod» завершилась с ошибкой кода 1
  16. 6 ответов
  17. Вопрос №56379 от пользователя Сергей в проекте «RSS агрегатор»

Error: Command «npm run build» exited with 1 #6515

<>’s edit

Area: Vercel CLI
Name: arduinoprojectportugal
Previous Page: Not Specified

21:08:31.746 Retrieving list of deployment files.
21:08:33.927 Downloading 10 deployment files.
21:08:34.049 Analyzing source code.
21:08:35.558 Installing build runtime.
21:08:38.317 Build runtime installed: 2.759s
21:08:41.187 Looking up build cache.
21:08:41.944 Build cache found. Downloading.
21:08:44.295 Build cache downloaded [25.80 MB]: 2351.317ms
21:08:45.452 Detected package.json
21:08:45.452 Installing dependencies.
21:08:49.290 npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I’ll try to do my best with it!
21:08:56.158 npm WARN @testing-library/user-event@12.8.3 requires a peer of @testing-library/dom@>=7.21.4 but none is installed. You must install peer dependencies yourself.
21:08:56.168 npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
21:08:56.178 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
21:08:56.178 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.187 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
21:08:56.187 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.195 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
21:08:56.195 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.197 up to date in 10.19s
21:08:57.260 145 packages are looking for funding
21:08:57.260 run npm fund for details
21:08:57.525 Running «npm run build»
21:08:57.797 > buda-velho@0.1.0 build /vercel/path0
21:08:57.797 > react-scripts build
21:08:59.564 Could not find a required file.
21:08:59.564 Name: index.html
21:08:59.565 Searched in: /vercel/path0/public
21:08:59.578 npm ERR! code ELIFECYCLE
21:08:59.578 npm ERR! errno 1
21:08:59.582 npm ERR! buda-velho@0.1.0 build: react-scripts build
21:08:59.582 npm ERR! Exit status 1
21:08:59.582 npm ERR!
21:08:59.582 npm ERR! Failed at the buda-velho@0.1.0 build script.
21:08:59.582 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
21:08:59.600 npm ERR! A complete log of this run can be found in:
21:08:59.600 npm ERR! /vercel/.npm/_logs/2021-07-24T20_08_59_583Z-debug.log
21:08:59.617 Error: Command «npm run build» exited with 1

answer from vercel:

Thank you for getting in touch, I’m sorry you’re having difficulty using the Vercel platform.

To help us provide assistance, please provide more context on the issue being faced by answering the questions below:

Once we have answers to the above questions, we will do our best to provide you with the assistance required to resolve your issue.

Matthew Sweeney
▲ Director of Customer Success at Vercel

I am expereincing the following behaviour, first run npx create-react-app my-app

then, use cd my-app

And everything goes ok

after a few changes on the code, the following errrors start appearing:

21:08:31.746 Retrieving list of deployment files.
21:08:33.927 Downloading 10 deployment files.
21:08:34.049 Analyzing source code.
21:08:35.558 Installing build runtime.
21:08:38.317 Build runtime installed: 2.759s
21:08:41.187 Looking up build cache.
21:08:41.944 Build cache found. Downloading.
21:08:44.295 Build cache downloaded [25.80 MB]: 2351.317ms
21:08:45.452 Detected package.json
21:08:45.452 Installing dependencies.
21:08:49.290 npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I’ll try to do my best with it!
21:08:56.158 npm WARN @testing-library/user-event@12.8.3 requires a peer of @testing-library/dom@>=7.21.4 but none is installed. You must install peer dependencies yourself.
21:08:56.168 npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
21:08:56.178 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
21:08:56.178 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.187 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
21:08:56.187 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.195 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
21:08:56.195 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»linux»,»arch»:»x64″>)
21:08:56.197 up to date in 10.19s
21:08:57.260 145 packages are looking for funding
21:08:57.260 run npm fund for details
21:08:57.525 Running «npm run build»
21:08:57.797 > buda-velho@0.1.0 build /vercel/path0
21:08:57.797 > react-scripts build
21:08:59.564 Could not find a required file.
21:08:59.564 Name: index.html
21:08:59.565 Searched in: /vercel/path0/public
21:08:59.578 npm ERR! code ELIFECYCLE
21:08:59.578 npm ERR! errno 1
21:08:59.582 npm ERR! buda-velho@0.1.0 build: react-scripts build
21:08:59.582 npm ERR! Exit status 1
21:08:59.582 npm ERR!
21:08:59.582 npm ERR! Failed at the buda-velho@0.1.0 build script.
21:08:59.582 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
21:08:59.600 npm ERR! A complete log of this run can be found in:
21:08:59.600 npm ERR! /vercel/.npm/_logs/2021-07-24T20_08_59_583Z-debug.log
21:08:59.617 Error: Command «npm run build» exited with 1

Also if I run this comand on the terminal: vercel version vercel CLI 23.0.1

npx create-react-app my-app cd my-app vercel

the default app runs well with the react logo rotating, linke in this this page:

React App Web site created using create-react-app my-ppa.vercel.app

but if I make a simple change. I cant run the app anymore, What should I do?

Beta Was this translation helpful? Give feedback.

Источник

npm run build exited with return -1 #126

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.1 (node_modulessanenode_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»win32″,»arch»:»x64″>)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_moduleschokidarnode_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted <«os»:»darwin»,»arch»:»any»>(current: <«os»:»win32″,»arch»:»x64″>)
npm WARN prettier-loader@2.0.0 requires a peer of webpack@^3.0.0 but none was installed.
npm WARN demo@0.0.1 No repository field.

error MSB3073: The command «npm install» exited with code -1.

The text was updated successfully, but these errors were encountered:

You can ignore the fsevents dependency because it is macOS (or iOS) only.

As for the prettier-loader, that isn’t used in this project, so I’m guessing you added it yourself. Did you add it in dependencies or devDependencies ?

Did you run a fresh npm install on the project to get started? It seems like it is not finding any of the dependencies.

Closing this because of no activity. Think this is done now. Feel free to open up another issue if you encounter problems.

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

«npm install» exited with code -1 on dotnet publish #9593

Steps to reproduce

  • Update SPA templates with dotnet new —install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0 .
  • Create a new SPA app with dotnet new angular .
  • Run dotnet restore in the root.
  • Run npm i in the ClientApp .
  • Run dotnet publish -c release -r win-x64 in the root.

Expected behavior

Get a published app.

Actual behavior

Get the error MSB3073: The command «npm install» exited with code -1. .

Additional info

App successfully run in debug mode in VS code. Only publish doesn’t work.

Environment data

dotnet —info output:

dotnet publish -c release -r win-x64 -v diag output (>38MB):
https://yadi.sk/i/bt6ATlRG3Z8sAc

pt.csproj source code:

netcoreapp2.0 true Latest false ClientApp $(DefaultItemExcludes);$(SpaRoot)node_modules** false

‘%(FullPath)’)» Exclude=»@(ResolvedFileToPublish)»> %(DistFiles.Identity) PreserveNewest

The text was updated successfully, but these errors were encountered:

Tried to fool dotnet and write as an instruction. Still get the same error (partially) — error MSB3073: The command «npm install & exit 0» exited with code -1. .

Updated node to 8.11.3 . No errors now.

Hey,
I have here the current vs code version with .net core and node 12, already tried with node 10 and I can reproduce the issue, any ideas how this can be fixed?

Hi,
try and edit your project file by removing the section below:

Then save, re-publish again.

Well, the publish is now working, but asp.net core is now not find the npm.

and yes, node and npm are sure installed and accessable via normal terminal in the container etc.

Источник

Команда «npm run build — —prod» завершилась с ошибкой кода 1

Я занимаюсь разработкой Asp.Net Core 2 и Angular 5 в Visual Studio 2017.

Когда я собираюсь опубликовать свой проект, в окне списка ошибок появляется ошибка « Команда« npm run build — —prod »с кодом 1 ».
Я создал проект с угловым интерфейсом командной строки в ASP.NET Core 2 угловой шаблон ссылка и все было хорошо, и проект запущен и опубликован правильно.
Через некоторое время я не знаю, что именно происходит, потому что проект не публикуется.

В файле npm-debug.log

6 ответов

Получил ту же ошибку, моя среда:

И ничто упомянутое выше не помогло. Просто зайдите в «. ClientApp» // Angular-CLI project и запустите

Тогда вы увидите реальные ошибки — значит, просто, у вас есть ошибки в коде, так что исправьте угловой код пользовательского интерфейса, и он будет прекрасно работать :).

Возможно в командной строке NodeJS версия Visual Studio старая. В выводе вашей команды мы можем увидеть:

Error: The command «npm install» exited with code 1

Добавьте переменную среды, щелкните правой кнопкой мыши на этом ПК

  • Перейти к свойствам
  • Перейти на вкладку «Дополнительно»
  • Нажмите переменную среды
  • В разделе «Пользовательские переменные» нажмите «Создать», введите имя переменной «Путь» и значение C:UsersUserAppDataRoamingnpm
  • Еще один — в разделе Пользовательские переменные нажмите new, введите имя переменной «Path» и значение C:Program Filesnodejs

Если переменная Path уже существует, вы можете отредактировать эту переменную, добавив новый путь (значение) путем разделения ; .

npm run build:prod — —prod

Чтобы увидеть фактическую ошибку / ошибки, которые привели к сбою вашей сборки. Обратите внимание, что команда имеет prod в качестве флага.

Проверьте это возможно у вас проблема с нехваткой памяти

Попробуйте запустить: ng build «prod» и посмотрите, что является настоящей ошибкой.

Источник

Вопрос №56379 от пользователя Сергей в проекте «RSS агрегатор»

Добрый день, не понимаю, как подключить Bootstrap через Webpack, пишу в терминале команду npm install bootstrap — выдает ошибку. И можно поподробнее описать процесс создания страницы

Сергей, без вывода ошибки трудно чем-то помочь.

Процесс создания страницы примерно следующий:

вам нужно создать файл index.html, поместить его в корень приложения. В этом файле у вас должна быть необходимая вам базовая разметка. Вы можете как сверстать все статические элементы, так и создать их через js. Затем, используя этот файл как шаблон, подключить с помощью плагина webpack html-webpack-plugin в него стили и скрипты. За подробностями обращайтесь к документации плагина.

при сборке webpacka возникает ошибка

ERROR in main Module not found: Error: Can’t resolve ‘./src’ in ‘/Users/Sergei/frontend-project-lvl3’ resolve ‘./src’ in ‘/Users/Sergei/frontend-project-lvl3’ using description file: /Users/Sergei/frontend-project-lvl3/package.json (relative path: .) Field ‘browser’ doesn’t contain a valid alias configuration using description file: /Users/Sergei/frontend-project-lvl3/package.json (relative path: ./src) no extension Field ‘browser’ doesn’t contain a valid alias configuration /Users/Sergei/frontend-project-lvl3/src doesn’t exist .js Field ‘browser’ doesn’t contain a valid alias configuration /Users/Sergei/frontend-project-lvl3/src.js doesn’t exist .json Field ‘browser’ doesn’t contain a valid alias configuration /Users/Sergei/frontend-project-lvl3/src.json doesn’t exist .wasm Field ‘browser’ doesn’t contain a valid alias configuration /Users/Sergei/frontend-project-lvl3/src.wasm doesn’t exist as directory /Users/Sergei/frontend-project-lvl3/src doesn’t exist

Почему при сборке он ругается на папку src , до которой мы еще не дошли?

Сергей, по умолчанию вебпак ищет точку входа в src/index.js. Вам нужно или создать такой файл по этому пути, или использовать заготовку, указанную в первом шаге.

Использовал заготовку, указанную в первом шаге, до файла babel.config.js, далее опять ошибка -Module not found: Error: Can’t resolve ‘babel-loader’ in ‘/Users/Sergei/frontend-project-lvl3’

Сергей, что значит «до файла babel.config.js»?

Роман, добрый день! с зависимостями разобрался, вебпак собирается. Но при деплое выходят ошибки: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I’ll try to do my best with it! ERROR in main 10:36:06.191 Module not found: Error: Can’t resolve ‘./src’ in ‘/vercel/path0’ webpack 5.47.1 compiled with 1 error in 116 ms Error: Command «npm run build» exited with 1

Сергей, только задеплоил ваш проект, сборка проходит нормально. При настройке деплоя в Vercel обратите внимание на то, какую папку вы указываете в качестве ваших исходников и какую папку указываете в качестве папки с собранными файлами. Посмотрел ваш проект, у вас много ненужных зависимостей. Используйте заготовку, можете её скачать и разрабатывать в ней – там настроено окружение.

Роман, правильно ли я понимаю, что источниками будет папка dist, а папка с собранными файлами — src. Но на гит я не коммитил папку dist и как указать ее через vercel?

пытаюсь настроить линтер, после инициализации и запуска выводит ошибки /Users/Sergei/frontend-project-lvl3/.eslintrc.js 1:1 error ‘module’ is not defined no-undef

/Users/Sergei/frontend-project-lvl3/babel.config.js 1:1 error ‘module’ is not defined no-undef

/Users/Sergei/frontend-project-lvl3/dist/main.js 17:9 error ‘unused_webpack_module’ is defined but never used no-unused-vars 17:34 error ‘webpack_exports_‘ is defined but never used no-unused-vars 17:55 error ‘webpack_require‘ is defined but never used no-unused-vars 27:9 error ‘unused_webpack_module’ is defined but never used no-unused-vars 27:34 error ‘webpack_exports‘ is defined but never used no-unused-vars 27:55 error ‘webpack_require‘ is defined but never used no-unused-vars 37:9 error ‘unused_webpack_module’ is defined but never used no-unused-vars 37:34 error ‘webpack_exports‘ is defined but never used no-unused-vars 37:55 error ‘webpack_require‘ is defined but never used no-unused-vars 47:9 error ‘module’ is defined but never used no-unused-vars 47:17 error ‘webpack_exports‘ is defined but never used no-unused-vars 47:38 error ‘webpack_require‘ is defined but never used no-unused-vars 57:9 error ‘module’ is defined but never used no-unused-vars 67:9 error ‘unused_webpack_module’ is defined but never used no-unused-vars 67:34 error ‘webpack_exports‘ is defined but never used no-unused-vars 67:55 error ‘webpack_require‘ is defined but never used no-unused-vars 77:9 error ‘module’ is defined but never used no-unused-vars 87:9 error ‘module’ is defined but never used no-unused-vars 97:9 error ‘module’ is defined but never used no-unused-vars 107:9 error ‘module’ is defined but never used no-unused-vars 107:17 error ‘unused_webpack_exports’ is defined but never used no-unused-vars 107:43 error ‘webpack_require‘ is defined but never used no-unused-vars 117:9 error ‘module’ is defined but never used no-unused-vars 127:9 error ‘module’ is defined but never used no-unused-vars 205:15 error ‘webpack_exports_’ is assigned a value but never used no-unused-vars

/Users/Sergei/frontend-project-lvl3/webpack.config.js 1:27 error ‘require’ is not defined no-undef 3:1 error ‘module’ is not defined no-undef 4:9 error ‘process’ is not defined no-undef

добавлял изменения в .eslintrc.js, ничего не помогает

Сергей, собранные файлы лежат в dist, исходный код — в src. Vercel делает сборку (npm run build) при деплое, так появляется dist. Всё это описано в документации к Vercel.

Судя по выводу ошибки, вы настойчиво игнорируете моё предложение использовать заготовку.

Добрый день, Роман! задеплоить удалось только через терминал (почитал документацию на vercel), теперь нельзя деплоить через сам vercel (вопрос, как вернуть все обратно). Зависимости все взял из заготовки (файл package.json). Как появляется Dist я понимаю, я не понимаю, почему у меня деплой проходит только через терминал, и почему не настраивается линтер

Сергей, возьмите заготовку полностью, в ней настроено всё окружение, сделайте npm install – после этого можете писать свой код в ./src .

В настройках проекта на vercel вам нужно изменить output directory на dist, и source code directory на ./src .

Источник

The following error will be displayed when i use the command «npm start».

> callcenter@0.1.0 start /var/www/html/dev/callcenter
> react-scripts start

sh: 1: react-scripts: Permission denied

npm ERR! Linux 4.4.0-1013-aws
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! callcenter@0.1.0 start: `react-scripts start`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the callcenter@0.1.0 start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the callcenter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs callcenter
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls callcenter
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/html/dev/callcenter/npm-debug.log

Rui F Ribeiro's user avatar

Rui F Ribeiro

54.8k26 gold badges144 silver badges221 bronze badges

asked Jul 26, 2017 at 13:24

Eswaran Arumugam's user avatar

1

Make sure that your react-script binary is executable.

$ chmod +x node_modules/.bin/react-scripts

answered Jul 26, 2017 at 22:13

Spack's user avatar

0

I encountered the same issue, Surprisingly it works fine in Windows but failed in Linux giving the same error. Follow below step to resolve this issue.

you need to change package.json file inside your project folder like below instead of default value of "start": "react-scripts start"

«scripts»: {
«start»: «node ./node_modules/react-scripts/bin/react-scripts.js start» }

answered Jan 20, 2019 at 4:05

Harsha Siriwardana's user avatar

2

Although the OP doesn’t really refer to my problem, this was the first stackexchange result in Google when searching for yarn build webpack: Permission denied, hence I’m adding my solution here in case it helps someone.

For those landing here because they are finding webpack: Permission denied when running yarn build on Linux even though the command works fine on Windows:

The problem in my case was that the *.lock files had some relation with the environment in which they were generated (Windows) and wouldn’t work in a different environment (WSL2 — Ubuntu)

  1. Remove node_modules

    rm -vrf node_modules
    
  2. Remove locks

    rm package-lock.json
    rm yarn.lock
    
  3. Run yarn

    yarn
    yarn build
    

answered Dec 30, 2020 at 10:57

JesusIniesta's user avatar

This page covers scenarios you may encounter during the Build step that will require you to troubleshoot, including:

  • Build errors that cancel a deployment
  • Long build times

You can use the following views on your dashboard to troubleshoot a build:

  • Build logs — the console output when your deployment is building which can be found under the Deployment Status section of the Project’s Deployment page
  • Source tab — the output of the build after the deployment is successful. This can also be accessed by appending /_src to the Deployment URL
  • Functions tab — the live console output for Serverless Functions at runtime (if your project uses this feature). This can also be accessed by appending /_logs to the Deployment URL

You can navigate to these views from the Deployment page by clicking on the Source tab, the Functions tab or the Building accordion as shown below.

Access Functions and Building Logs view from the Deployment page.

If your build fails, the related error is reported in the logs found inside the Building accordion described above. To access these logs, you have the following options:

  • If the failed build is the most recent deployment, you will see an Error in the Upcoming section below the Deployment preview on the Project’s overview page as shown below. Click on link next to the Error to be directed to the specific Deployment’s page

Error in the upcoming Deployment.

  • You can also access the errored deployment’s page from the Deployments tab as shown below

Error in the Deployments tab.

Once you are on the errored deployment’s page, you will be shown a summary of the error in the preview section. This error can often be generic as in the example below.

Error summary on a specific deployment’s page.

To investigate further, open the Building accordion to expand the logs. Scroll down until you find a red section where Error is mentioned. It can be mentioned once or multiple times. In many cases, the last mention is not indicative like in the example below where it says yarn run build exited with 1. If you look a few lines above, you will see an additional error which in this case indicates where the problem is with a link for more details. Sometimes, an error may not be mentioned in the lines above but the output will often help you identify where the problem is.

Error in the logs of the Building accordion.

It is recommended to build your project on your local machine first (the build command varies per project) before deploying on Vercel. This will catch issues specific to your code or to your project’s dependencies. In the example above, when the command npm run build (that runs next build) is run in the local console for a Next.js project, the error happens after building locally.

Error in local console.

Sometimes, your Deployment Build can hit platform limits so that the build will be cancelled and throw a corresponding error that will be shown in the Build logs. Review the limits below in case you run into them.

Every Build is provided with the following resources:

  • 8192 MB of memory
  • 4 CPUs
  • 13 GB of disk space

This cannot be increased. If your build is cancelled due to any of these three limits, you will see errors like memory allocation error or Out of disk space in the Build logs. Review the below steps to help navigate this situation:

  • Review what package the error is related to and explore the package’s documentation to see if the memory allocation can be customized with an install or Build command
  • If no package is specified, look into reducing the amount of JavaScript that your Project might be using or find a more efficient JavaScript bundler
  • Review what you are importing in your code such as third-party services, icons and media files

The total build duration is shown on the Vercel Dashboard and includes all three steps: building, checking, and assigning domains. Each step also shows the individual duration.

A Build can last for a maximum of 45 minutes. If the build exceeds this time, the deployment will be canceled and the error will be shown on the Deployment’s Build logs. If you run into this limit, review this guide that explains how to reduce the Build time with a Next.js Project.

The maximum size of the Build’s cache is 1 GB. It is retained for one month and it applies at the level of each Build cache key.

It is not possible to manually configure which files are cached at this time.

You may come across the following Build-specific errors when deploying your Project. The link for each error provides possible causes of the error that can help you troubleshoot.

  • Missing Build script
  • Recursive invocation of commands

A ‘module not found’ error is a syntax error that will appear at build time. This error appears when the static import statement cannot find the file at the declared path. For more information, see How do I resolve a ‘module not found’ error?

The first Build in a Project will take longer as the Build cache is initially empty. Subsequent builds that have the same Build cache key will take less time because elements from your build, such as framework files and node modules, will be reused from the available cache. The next sections will describe the factors that affect the Build cache to help you decrease the Build time

Vercel caches files based on the Framework Preset selected in your Project settings. The following files are cached in addition to node_modules/**, yarn.lock, and package-lock.json.

Framework

Cache Pattern

Next.js

.next/cache/**

Nuxt.js

.nuxt/**

Gatsby.js

{.cache,public}/**

Eleventy

.cache/**

Jekyll

{vendor/bin,vendor/cache,vendor/bundle}/**

Middleman

{vendor/bin,vendor/cache,vendor/bundle}/**

Note that the framework detection is dependent on the preset selection made in the Build settings. You should make sure that the correct framework is set for your project for optimum build caching.

At the beginning of each build, the previous Build’s cache is restored prior to the Install Command or Build command executing. Each deployment is associated with a unique Build cache key that is derived from the combination of the following data:

  • Personal Account or Team
  • Project
  • Framework Preset
  • Root Directory
  • Node.js Version
  • Package Manager
  • Git branch

Let’s say that under your account MyTeam, you have a project MySite that is connected to your Git repository MyCode on the main branch for the production environment. When you make a commit to the main branch for the first time, you trigger a build that creates a production deployment with a new unique cache key. For any new commits to the main branch of MyCode, the existing Build cache is used as long as MySite is under MyTeam.

If you create a new Git branch in MyCode and make a commit to it, there is no cache for that specific branch. In this case, the last production Deployment cache is used to create a preview deployment and a new branch cache is created for subsequent commits to the new branch.

If you use Serverless Functions to process HTTP requests in your project, each Serverless Function is built separately in the Build step and has its own cache, based on the Runtime used. Therefore, the number and size of Serverless Functions will affect your Build time. For Next.js projects, Serverless Functions are bundled to optimize Build resources as described here.

At the end of each Build step, successful builds will update the cache and failed builds will not modify the existing cache.

Since development dependencies (for example, packages such as webpack or Babel) are not needed in production, you may want to prevent them from being installed when deploying to Vercel to reduce the Build time. To skip development dependencies, customize the Install Command to be npm install --only=production or yarn install --production.

Sometimes, you may not want to use the Build cache for a specific deployment. You can invalidate or delete the existing Build cache in three ways:

  • Use the «Redeploy» button for the specific deployment in the Project’s Deployments page. In the popup window that follows, leave the checkbox Redeploy with existing Build Cache unchecked. This is explained in more detail here
  • Use vercel --force with Vercel CLI to build and deploy the project without the Build cache
  • Use an Environment Variable VERCEL_FORCE_NO_BUILD_CACHE with a value of 1 on your project to skip the Build cache

Note: When redeploying without the existing Build Cache, the Remote Cache from Turborepo and Nx are automatically excluded.

Vercel uses Amazon Linux 2 as a base image for all builds and several pre-installed packages.

The following packages are pre-installed in the build image with yum, the default package manager for Amazon Linux 2.

Pre-installed packages

alsa-lib

at-spi2-atk

atk

autoconf

bsdtar

bzip2

bzip2-devel

cups-libs

expat-devel

gcc

gcc-c++

git

glib2-devel

glibc-devel

gtk3

gzip

ImageMagick-devel

libXScrnSaver

libXcomposite

libXcursor

libXi

libXrandr

libXtst

libffi-devel

libglvnd-glx

libicu

libjpeg

libjpeg-devel

libpng

libpng-devel

libstdc++

libwebp-tools

make

ncurses-libs

openssl

openssl-devel

openssl-libs

pango

readline-devel

ruby-devel

strace

tar

unzip

which

zlib-devel

To run the build image locally with Amazon Linux 2, use the following command:

docker run --rm -it amazonlinux:2.0.20191217.0 sh

When you are done, run exit to return.

To add php to your path, run the following command:

amazon-linux-extras install php7.4

To add cargo to your path, run the following command:

amazon-linux-extras install rust1

To add go to your path, run the following command:

amazon-linux-extras install golang1.11

Learn more about Amazon Linux Extras.

The build image includes access to repositories with stable versions of popular packages. You can list all packages with the following command:

You can search for a package by name with the following command:

yum search my-package-here

You can install a package by name with the following command:

yum install my-package-here -y

You can use Amazon Linux Extras if you need a new or newer version of an existing software package that is not included in the default repositories.

You can list extra packages with the following command:

You can install extra packages with the following command:

amazon-linux-extras install my-package-here

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Error command give not found перевод
  • Error command gcc failed no such file or directory alpine
  • Error command failed with exit code 3221225477
  • Error command failed with exit code 2147483651
  • Error command failed with exit code 137 yarn

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии