svanderburg / node2nix

Generate Nix expressions to build NPM packages
MIT License
518 stars 98 forks source link

TypeError: Cannot read property 'substr' of undefined #238

Open happysalada opened 3 years ago

happysalada commented 3 years ago

I got the error while running node2nix --development -l package-lock.json

The package-lock.json was generated with node 16.3.0

Here is the package.json

package.json! ``` { "name": "union", "version": "0.0.1", "description": "Union is a platform to match talented traders with investors. For traders, its aim is helping develop their skill. For investors it helps find good alternative sources of investment", "repository": {}, "license": "MIT", "scripts": { "deploy": "webpack --config ./webpack/webpack.prod.js", "watch": "webpack --config ./webpack/webpack.dev.js" }, "browserslist": [ "last 1 version", "not dead", "> 0.2%" ], "dependencies": { "@sentry/browser": "^6.5.1", "@sentry/tracing": "^6.5.1", "alpinejs": "^2.8.2", "core-js": "^3.14.0", "currency.js": "^2.0.4", "nprogress": "^0.2.0", "phoenix": "^1.5.9", "phoenix_html": "^2.14.3", "phoenix_live_view": "^0.15.7", "regenerator-runtime": "^0.13.7" }, "devDependencies": { "@babel/core": "^7.14.5", "@babel/plugin-proposal-object-rest-spread": "^7.14.5", "@babel/plugin-transform-runtime": "^7.14.5", "@babel/preset-env": "^7.14.5", "@babel/runtime": "^7.14.5", "@fullhuman/postcss-purgecss": "^4.0.3", "@tailwindcss/forms": "^0.3.3", "autoprefixer": "^10.2.6", "babel-loader": "^8.2.2", "browserslist": "^4.16.6", "compression-webpack-plugin": "^8.0.0", "copy-webpack-plugin": "^9.0.0", "css-loader": "^5.2.6", "css-minimizer-webpack-plugin": "^3.0.1", "cssnano": "^5.0.5", "file-loader": "^6.2.0", "mini-css-extract-plugin": "^1.6.0", "postcss": "^8.3.1", "postcss-cli": "^8.3.1", "postcss-import": "^14.0.2", "postcss-loader": "^5.3.0", "style-loader": "^2.0.0", "tailwindcss": "^2.1.4", "terser-webpack-plugin": "^5.1.3", "webpack": "^5.38.1", "webpack-bundle-analyzer": "^4.4.2", "webpack-cli": "^4.7.2", "webpack-merge": "^5.8.0", "webpack-notifier": "^1.13.0" } } ```
happysalada commented 3 years ago

package-lock.gz

happysalada commented 3 years ago

I understand that this is one of the newer version of node, I'm just pointing this out. Thanks a lot for all the hard work that went into this node2nix!

WolfangAukang commented 2 years ago

Just wanted to comment that I'm also having the same issue with the same command

thomasjm commented 2 years ago

Like others reported, I saw this when using a new version of npm. It seemed to be due to the fact that package-lock.json was getting generated without integrity fields, which this tool expects.

The solution for me was to remove node_modules and regenerate:

rm -rf node_modules
rm -f package-lock.json
npm install
npm run node2nix --development --lock package-lock.json