4

I created a React app by the command create-react-app qiyujidemo I installed and can run the app well. Then I installed a module with npm install [email protected] react-weui --save. After the module is installed, I type the npm start. Then, there is something wrong.

[email protected] start /Users/yianwork/wechat/qiyujidemo
react-scripts start
sh: react-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: react-scripts start
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] 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/yianwork/.npm/_logs/2017-08-07T08_41_16_944Z-debug.log

I copy the /Users/yianwork/.npm/_logs/2017-08-07T08_41_16_944Z-debug.log.

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.1.0_1/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'start' ]
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 silly lifecycle [email protected]~prestart: no script for prestart, continuing
7 info lifecycle [email protected]~start: [email protected]
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/yianwork/wechat/qiyujidemo/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/yianwork/Library/Android/sdk/tools:/Users/yianwork/Library/Android/sdk/platform-tools
10 verbose lifecycle [email protected]~start: CWD: /Users/yianwork/wechat/qiyujidemo
11 silly lifecycle [email protected]~start: Args: [ '-c', 'react-scripts start' ]
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `react-scripts start`
13 verbose stack spawn ENOENT
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:33:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:887:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/yianwork/wechat/qiyujidemo
16 verbose Darwin 16.4.0
17 verbose argv "/usr/local/Cellar/node/8.1.0_1/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v8.1.0
19 verbose npm  v5.0.3
20 error file sh
21 error code ELIFECYCLE
22 error errno ENOENT
23 error syscall spawn
24 error [email protected] start: `react-scripts start`
24 error spawn ENOENT
25 error Failed at the [email protected] start script.
25 error This is probably not a problem with npm. There is likely additional logging output above.
26 verbose exit [ 1, true ]

I type the yarn start, then the following error is shown:

yians-iMac:qiyujidemo yianwork$ yarn start
yarn start v0.24.5
$ react-scripts start
sh: react-scripts: command not found
error Command failed with exit code 127.

Who can solve this problem? What is wrong?

I create a new project by create-react-app. It runs well. Then I installed the React-router, and the same problem occurs. I uninstalled react-weui, but still it can't run.

When I write the yarn add antd in the create-react-app demo, the project is run well. Must I use yarn to add a dependency?

7
  • Does it works again if you uninstall those packages ? npm uninstall weui react-weui --save Commented Aug 7, 2017 at 9:21
  • @Fawaz I create a new project by create-react-app. It runs well. Then I install the npm install --save react-router, and the same problem show. I run the npm uninstall weui react-weui --save it can't run yet. Commented Aug 7, 2017 at 9:31
  • did you install create-react-app globally ? Did you clean your node_modules folders ? stackoverflow.com/questions/40546231/… Commented Aug 7, 2017 at 9:39
  • @Nevosis As I can use the create-react-app in every folder, I think I install the create-react-app globally. I delete the node_modules and install again, the project can't run yet. Commented Aug 7, 2017 at 10:05
  • 2
    @jiexishede Its also been reported that there are issues with npm v5 here stackoverflow.com/questions/44860917/… So can you downgrade and check if that works like suggested in the link. Commented Aug 7, 2017 at 10:22

1 Answer 1

0

Do you have react-scripts in your package.json? If not, install it and add the following to your package.json:

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "predeploy": "npm run build && cp CNAME build/CNAME",
    "deploy": "gh-pages -d build"
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.