无法在create-react-app中运行npm start

时间:2019-05-25 09:27:49

标签: node.js reactjs npm

问题

需要运行我的React项目

我已经安装了create-react-app并创建了一个项目,当我尝试使用npm运行项目时,开始显示一些错误

当我第一次在自己的目录中尝试一切正常时,仅当我尝试在特定目录中创建并运行时才出现问题

使用 Kubuntu OS, Node.js的:V10.15.3 npm:6.9.0

通过Google的一小部分,我做了以下事情

  1. 删除节点模块并安装
  2. 清除npm缓存,然后再次尝试新鲜
  3. 卸载并安装node和npm
  4. 以超级用户身份访问项目

  5. 当我尝试:npm ls反应

    • kasi @ kasi:〜/ my / node_modules $ npm ls反应

      my@0.1.0 / home / kasi / my

      `-react@16.8.6

没有其他事情

  1. 某些Google-检查点:

    • kasi @ kasi:〜/ my / node_modules $哪个节点

      /home/kasi/.nvm/versions/node/v10.15.3/bin/node

    • kasi @ kasi:〜/ my / node_modules $其中npm

      / usr / bin / npm

    • kasi @ kasi:〜/ my / node_modules $ cd ../../../../ usr / local / bin /
    • kasi @ kasi:/ usr / local / bin $ ls

      create-react-app n节点npx tsc tsserver

提示: 我所有的磁盘都是FAT类型,因此symlink上可能存在一些问题

  1. 当我尝试按以下方式直接开始时
    • kasi @ kasi:/ media / kasi / others / reaact / myapp $节点node_modules / react-scripts / scripts / start.js

它显示

Starting the development server...

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: spawn /media/kasi/others/reaact/myapp/node_modules/opn/xdg-open EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

我将附加创建的日志文件

0 info it worked if it ends with ok

1 verbose cli [ '/home/kasi/.nvm/versions/node/v10.15.3/bin/node',

1 verbose cli   '/usr/bin/npm',

1 verbose cli   'start' ]

2 info using npm@6.9.0

3 info using node@v10.15.3

4 verbose run-script [ 'prestart', 'start', 'poststart' ]

5 info lifecycle myapp@0.1.0~prestart: myapp@0.1.0

6 info lifecycle myapp@0.1.0~start: myapp@0.1.0

7 verbose lifecycle myapp@0.1.0~start: unsafe-perm in lifecycle true

8 verbose lifecycle myapp@0.1.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/media/kasi/others/reaact/myapp/node_modules/.bin:/home/kasi/.nvm/versions/node/v10.15.3/bin:/home/kasi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

9 verbose lifecycle myapp@0.1.0~start: CWD: /media/kasi/others/reaact/myapp

10 silly lifecycle myapp@0.1.0~start: Args: [ '-c', 'react-scripts start' ]

11 info lifecycle myapp@0.1.0~start: Failed to exec start script

12 verbose stack Error: myapp@0.1.0 start: `react-scripts start`

12 verbose stack spawn ENOENT

12 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)

12 verbose stack     at ChildProcess.emit (events.js:189:13)

12 verbose stack     at maybeClose (internal/child_process.js:970:16)

12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)

13 verbose pkgid myapp@0.1.0

14 verbose cwd /media/kasi/others/reaact/myapp

15 verbose Linux 4.18.0-18-generic

16 verbose argv "/home/kasi/.nvm/versions/node/v10.15.3/bin/node" "/usr/bin/npm" "start"

17 verbose node v10.15.3

18 verbose npm  v6.9.0

19 error file sh

20 error code ELIFECYCLE

21 error errno ENOENT

22 error syscall spawn

23 error myapp@0.1.0 start: `react-scripts start`

23 error spawn ENOENT

24 error Failed at the myapp@0.1.0 start script.

24 error This is probably not a problem with npm. There is likely additional logging output above.

25 verbose exit [ 1, true ]

0 个答案:

没有答案