【发布时间】:2021-09-27 14:09:56
【问题描述】:
我在本地服务器上运行系统时遇到问题。
我尝试运行 npm install 然后 npm run start 然后我开始收到此错误:
Failed to compile
./src/app/App.js
Module not found: Can't resolve 'assets/css/style.css' in '/Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console/src/app'
我试过npm install npm run build 然后我得到以下错误:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! console2@0.1.0 build: `npm run build-css && react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the console2@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/av/.npm/_logs/2021-09-27T13_40_54_796Z-debug.log
我检查了记录的文件,发现了这个:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@6.14.15
3 info using node@v14.17.6
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle console2@0.1.0~prebuild: console2@0.1.0
6 info lifecycle console2@0.1.0~build: console2@0.1.0
7 verbose lifecycle console2@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle console2@0.1.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle console2@0.1.0~build: CWD: /Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console
10 silly lifecycle console2@0.1.0~build: Args: [ '-c', 'npm run build-css && react-scripts build' ]
11 silly lifecycle console2@0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle console2@0.1.0~build: Failed to exec build script
13 verbose stack Error: console2@0.1.0 build: `npm run build-css && react-scripts build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:400:28)
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:400:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid console2@0.1.0
15 verbose cwd /Volumes/Macbook Pro/02 - Business/03 - Projects/01 - All Clients/VS/MLM/03 - Source Codes/Live System/console
16 verbose Darwin 18.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v14.17.6
19 verbose npm v6.14.15
20 error code ELIFECYCLE
21 error errno 1
22 error console2@0.1.0 build: `npm run build-css && react-scripts build`
22 error Exit status 1
23 error Failed at the console2@0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
我尝试了以下步骤,但我得到了同样的错误:
npm cache clean --force
delete node_modules folder
delete package-lock.json file
sudo npm install npm@latest -g this will upgrade npm to latest version
npm audit fix --force
npm upgrade --force
npm install
【问题讨论】:
-
看起来像一个错误的导入路径。资产在哪里?
-
@Morgan :资产在我的本地文件夹中。我从 gitlab 做了一个
git pull master -
相对于 App.js 的资产在哪里?
-
@Morgan:在我的控制台本地文件夹中。这是截图 --> imgur.com/a/y7uVJwZ
标签: javascript node.js npm mamp