可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Transpiling via gulp-babel for the server and browserify with babelify for the client - using async and await in my code. These features seem to transform just fine, but... Error: Cannot find module 'babel-runtime/helpers/typeof'
Contents of .babelrc
{ "presets": ["react", "es2015"], "plugins": [ "transform-class-properties", "transform-async-to-generator", "transform-runtime" ] }
Relevant contents of package.json
"babel-core": "6.3.13", "babel-eslint": "4.1.6", "babel-plugin-transform-async-to-generator": "6.3.13", "babel-plugin-transform-class-properties": "6.3.13", "babel-plugin-transform-runtime": "6.3.13", "babel-preset-es2015": "6.3.13", "babel-preset-react": "6.3.13", "babelify": "7.2.0", "browserify": "12.0.1", "gulp-babel": "6.1.0",
I have found a few other mentions of this, many of which seem to lead here - https://github.com/babel/babel/issues/2954
But I am getting a 404 at the link above and indeed cannot see any issues related to babel - https://github.com/babel/babel/issues redirects to https://github.com/babel/babel/pulls
Any ideas?
回答1:
Turns out I needed to take the install of babel-runtime, which I thought had been deprecated with the release of Babel v6.
回答2:
When I faced this, it was my version of npm. I had new installation of Ubuntu 16.04 and had used nodenv to get node 4.2.3 going, but hadn't updated npm from whatever default I had. So using npm update -g npm changed from version 2.14.7 to 3.10.5. I deleted node_modules and ran npm i again, and I did not see the error message after that. (Note that deleting node_modules and running npm i without updating npm didn't work.)
回答3:
Looks like they have migrated all issues to another system: https://phabricator.babeljs.io/T2954
回答4:
I was facing this error and was up whole night to find a solution, in the end just deleted node_modules folder, did npm install and it worked
回答5:
I had a similar problem:
error in cannot find module 'babel-runtime/helpers/interop-require-default'
The way I dealt with it is to:
- delete node_modules folder
- re
npm install, and it works this time
回答6:
I Had more or less similar kind of error
"Cannot find module 'babel-generator'. Had no clue on how to debug them. So I finally decided to
Delete the Node Modules, Sometimes the (windows 'del node_modules' command does not delete the node_modules) in that case ,delete them manually.
npm cache clean --force
npm cache clear --force
npm prune
npm install
this approach did work for me.