简体   繁体   English

create-react-app npm start错误:找不到模块'@ webassemblyjs / ast'

[英]create-react-app npm start Error: Cannot find module '@webassemblyjs/ast'

I am just starting to learn react and I'm following the first part of this tutorial. 我刚刚开始学习反应,并且正在关注本教程的第一部分。 https://www.codecademy.com/articles/how-to-create-a-react-app https://www.codecademy.com/articles/how-to-create-a-react-app

I have run the following commands in Terminal: 我已经在终端中运行以下命令:

npm install -g create-react-app
create-react-app ravenous
# I've also tried npx create-react-app ravenous as per the official React website)
# Both timesI receive a successful output that ends with 'Happy hacking'
cd ravenous
npm start

But I receive the following error in the terminal. 但是我在终端中收到以下错误。

npm start

> ravenous@0.1.0 start /Users/sarah/sites/ravenous
> react-scripts start

module.js:559
    throw err;
    ^

Error: Cannot find module '@webassemblyjs/ast'
    at Function.Module._resolveFilename (module.js:557:15)
    at Function.Module._load (module.js:484:25)
    at Module.require (module.js:606:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/sarah/sites/ravenous/node_modules/webpack/lib/wasm/WebAssemblyParser.js:7:11)
    at Module._compile (module.js:662:30)
    at Object.Module._extensions..js (module.js:673:10)
    at Module.load (module.js:575:32)
    at tryModuleLoad (module.js:515:12)
    at Function.Module._load (module.js:507:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ravenous@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ravenous@0.1.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/sarah/.npm/_logs/2018-10-16T17_12_05_840Z-debug.log

In node_modules I do have the @webassemblyjs/ast folder. 在node_modules中,我确实有@ webassemblyjs / ast文件夹。 The debug.log has this: 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@5.6.0
3 info using node@v9.6.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle ravenous@0.1.0~prestart: ravenous@0.1.0
6 info lifecycle ravenous@0.1.0~start: ravenous@0.1.0
7 verbose lifecycle ravenous@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle ravenous@0.1.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/s$
9 verbose lifecycle ravenous@0.1.0~start: CWD: /Users/sarah/sites/ravenous
10 silly lifecycle ravenous@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle ravenous@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle ravenous@0.1.0~start: Failed to exec start script
13 verbose stack Error: ravenous@0.1.0 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:285:16)
13 verbose stack     at EventEmitter.emit (events.js:127: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:127:13)
13 verbose stack     at maybeClose (internal/child_process.js:933:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid ravenous@0.1.0
15 verbose cwd /Users/sarah/sites/ravenous
16 verbose Darwin 16.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v9.6.1
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error ravenous@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the ravenous@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Here is my ravenous/package.json 这是我的ravenous / package.json

{
"name": "ravenous",
"version": "0.1.0",
"private": true,
"dependencies": {
  "react": "^16.5.2",
  "react-dom": "^16.5.2",
  "react-scripts": "2.0.5"
},
"scripts": {
  "start": "react-scripts start",
  "build": "react-scripts build",
  "test": "react-scripts test",
  "eject": "react-scripts eject"
},
"eslintConfig": {
  "extends": "react-app"
},
"browserslist": [
  ">0.2%",
  "not dead",
  "not ie <= 11",
  "not op_mini all"
]
}

I've checked the folder permissions on the filesystem once the ravenous folder is created, set everything to Read & Write and then retried npm start but this doesn't seem to make a difference. 一旦创建了贪婪的文件夹,我就检查了文件系统上的文件夹权限,将所有内容都设置为“读写”,然后重试npm start,但这似乎没有什么不同。

I've tried deleting package-lock.json and node_modules and rerunning npm install . 我试过删除package-lock.json和node_modules并重新运行npm install It doesn't help the issue although strangely package-lock.json is not recreated when I do this. 尽管执行此操作时未重新创建package-lock.json,但对问题无济于事。

I am on Mac OS Sierra 10.12.6 我在Mac OS Sierra 10.12.6上

npm -v gives me 5.6.0 npm -v给我5.6.0

node -v gives me 9.6.1 node -v给我9.6.1

I downloaded the "recommended for most users" release of Node.js (currently 8.12.0 LTS) and reinstalled node. 我下载了Node.js的“推荐给大多数用户”版本(当前为8.12.0 LTS)并重新安装了节点。

I'm now on node 8.12.0 and npm 6.4.1 and npm start is now working. 我现在在节点8.12.0和npm 6.4.1上,并且npm start现在可以工作了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 create-react-app 和 npm 启动时出现错误“找不到模块” - Error "Module not found" while create-react-app and npm start 构建运行时出现webpack错误。 &#39;错误:找不到模块&#39;@ webassemblyjs / ast&#39; - webpack error on build run. 'Error: Cannot find module '@webassemblyjs/ast'' 在npm上启动启动应用程序时出错 - Getting error on npm start create-react-app 使用 Moment JS 创建 React-App:找不到模块“./locale” - Create-React-App with Moment JS: Cannot find module “./locale” Create-react-app返回“无法找到模块&#39;rxjs&#39;” - Create-react-app returns “Cannot find module 'rxjs'” create-react-app 后无法启动项目:错误:找不到模块“C:\Users\pcname\Documents\react-scripts\bin\react-scripts.js” - Unable to start project after create-react-app: Error: Cannot find module 'C:\Users\pcname\Documents\react-scripts\bin\react-scripts.js' 使用 npm 安装 create-react-app 时出错 - Error installing create-react-app with npm 在“npx create-react-app”“npm start”失败并出现以下错误后:TypeError: Cannot read property 'split' of undefined - After "npx create-react-app" "npm start" fails with following error: TypeError: Cannot read property 'split' of undefined 使用Npm start启动项目期间在Project中获取错误,使用create-react-app创建项目 - Getting Error in Project during start project with Npm start, Project created with create-react-app 运行 npm 启动和使用 npx create-react-app 创建 React 应用程序时出错 - Error running npm start and creating React application using npx create-react-app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM