Cannot find module 'to-fast-properties'
See original GitHub issueBabel Configuration (.babelrc, package.json, cli command)
webpack.config.js
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/assets',
},
devServer: {
contentBase: path.resolve(__dirname, './src'),
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
sourceMap: true
}),
],
module: {
loaders: [
{test: /\.js$/, loader: 'babel-loader', exclude: /(\.test.js$|node_modules)/},
{test: /\.css$/, loader: 'style-loader!css-loader'},
{test: /\.tpl.html/, loader: 'html-loader'},
{test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/, loader: 'url-loader?limit=50000'}
]
},
};
package.json
"devDependencies": {
"angular-mocks": "^1.6.2",
"awesome-typescript-loader": "^3.0.4",
"babel-core": "^6.23.1",
"babel-loader": "^6.3.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.22.0",
"babel-register": "^6.23.0",
"babel-runtime": "^6.23.0",
"chai": "^3.5.0",
"chalk": "^1.1.3",
"clean-webpack-plugin": "^0.1.15",
"connect": "^3.6.0",
"cross-env": "^3.1.4",
"css-loader": "^0.26.1",
"eslint": "^3.15.0",
"eslint-config-defaults": "^9.0.0",
"file-loader": "^0.10.0",
"gulp": "^3.9.1",
"gulp-webpack": "^1.5.0",
"html-loader": "^0.4.4",
"html-webpack-plugin": "^2.28.0",
"jasmine-core": "^2.5.2",
"karma": "^1.4.1",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.1.0",
"karma-mocha-reporter": "^2.2.2",
"karma-webpack": "^2.0.2",
"minimist": "^1.2.0",
"mocha": "^3.2.0",
"ngtemplate-loader": "^1.3.1",
"open-browser-webpack-plugin": "0.0.4",
"serve-static": "^1.11.2",
"sinon": "^1.17.7",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.1"
}
Expected Behavior
Webpack/Babel to successfully build my application
Current Behavior
ERROR in ./src/main.js Module build failed: Error: Cannot find module ‘to-fast-properties’ at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object.<anonymous> (/Users/{}/dev/node_modules/babel-types/lib/index.js:311:25) at Module._compile (module.js:571:32) at Object.Module._extensions…js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3)
Context
Any time I try to run webpack with babel-loader it breaks because it cannot find to-fast-modules even though it is in the node_modules directory. I have done everything from npm cache clean && rm -rf node_modules && npm install to removing all globally installed node packages to completely uninstall and reinstalling node itself and still this problem persists.
Your Environment
| software | version |
|---|---|
| Babel | 6.23.1 |
| node | 7.5 (but also 6.9.5) |
| npm | 4.1.2 (but also 3.10.10) |
| Operating System | OSX 10.12.3 |
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Related StackOverflow Question
Would you be able to zip up an example repo, including node_modules, and post it somewhere I could look at? Also feel free to join our Slack if you want a faster back-and-forth.
Right, I updated my npm and it was taken care of. Some other dependency must have drawn this out in a weird way. Thanks!