2

Coworker created an project with create-react-app, it works on his computer. I cloned, ran npm install, and then npm start, got the following failing error:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/local/Cellar/node/15.8.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/dzhai/Documents/workplace/tcoe-candyjar/apis/src/main/app/node_modules/.bin:/usr/local/opt/icu4c/sbin:/usr/local/opt/icu4c/bin:/usr/local/opt/gnu-getopt/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/dzhai/Library/Python/3.7/bin:/Library/Apple/usr/bin:/opt/apache-maven/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/dzhai/Library/Python/3.7/bin:/Library/Apple/usr/bin
9 verbose lifecycle [email protected]~start: CWD: /Users/dzhai/Documents/workplace/tcoe-candyjar/apis/src/main/app
10 silly lifecycle [email protected]~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `react-scripts start`
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 (node:events:378:20)
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 (node:events:378:20)
13 verbose stack     at maybeClose (node:internal/child_process:1067:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/dzhai/Documents/workplace/tcoe-candyjar/apis/src/main/app
16 verbose Darwin 19.6.0
17 verbose argv "/usr/local/Cellar/node/15.8.0/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v15.8.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `react-scripts start`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

can someone help with this? thanks

PS: I have tried removing node_modules and rerun npm install, uninstall/reinstall node, and etc.

Found this thread https://github.com/facebook/create-react-app/issues/9594 which seems to indicate reinstalling node would fix the issue, but it's not working for me.

Follow-up: completely removed node with additional manual steps, e.g., as suggested here https://stackabuse.com/how-to-uninstall-node-js-from-mac-osx/, then repeat the process, then got a slightly different error log:

23 verbose stack Error: command failed
23 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
23 verbose stack     at ChildProcess.emit (node:events:378:20)
23 verbose stack     at maybeClose (node:internal/child_process:1067:16)
23 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
3
  • Is it the same if you launch with BROWSER=none? Commented Feb 10, 2021 at 19:32
  • sorry, new to this, do you mean running "npm start BROWSER=none", which i just did, and it's returning the same results. Commented Feb 10, 2021 at 19:45
  • More like BROWSER=none npm start or whatever the current way to start up CRA apps is--it's just a sanity check. There are several things that can cause startup failures; you'll probably have to search and just start plugging through them, but start w/ checking versions of everything and make sure they're aligned (e.g., NodeJS and CRA to start). Commented Feb 10, 2021 at 19:53

1 Answer 1

4

Finally figured it out after two day's of struggle, the current app is a sub-sub-project located in a path like this: main-project/sub-project1/src/main/sub-sub-project1. But there are a bunch of remnant node files (package.json and etc.) in the sub-project1 folder from another coworker's past work, and apparently I have run "npm install" and generated a node_modules/ folder there, since it's gitignored, I never realized that. This node_modules/ folder is what's causing confusions for the node commands when they are being run in the sub-sub-project1 folder, where another node_modules/ is present.

To summarize, don't have multiple node projects in this kind of linear hierarchical manner, it may cause the node commands to be confused.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.