strapi / strapi

πŸš€ Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable and developer-first.
https://strapi.io
Other
62.9k stars 7.9k forks source link

npm run setup fails #3097

Closed selfagency closed 5 years ago

selfagency commented 5 years ago

Informations

What is the current behavior?

The build process crashes.

> strapi-admin@3.0.0-alpha.23.1 setup /apps/kifa-cms/admin
> node ./scripts/setup.js

πŸ—  Building the admin...

> strapi-admin@3.0.0-alpha.23.1 prebuild /apps/kifa-cms/admin
> APP_PATH=$APP_PATH node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production IS_ADMIN=true node ./node_modules/strapi-helper-plugin/lib/internals/scripts/loadAdminConfigurations.js

> strapi-admin@3.0.0-alpha.23.1 build /apps/kifa-cms/admin
> APP_PATH=$APP_PATH npm run build:dll && node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production IS_ADMIN=true node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress

> strapi-admin@3.0.0-alpha.23.1 build:dll /apps/kifa-cms/admin
> APP_PATH=$APP_PATH node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production IS_ADMIN=true node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.dll.babel.js --color -p --progress

Hash: 58606774b0e11691f38d
Version: webpack 3.12.0
Time: 18367ms
            Asset       Size  Chunks                    Chunk Names
    vendor.dll.js     524 kB       0  [emitted]  [big]  vendor
vendor.dll.js.map  181 bytes       0  [emitted]         vendor
  [49] (webpack)/buildin/global.js 509 bytes {0} [built]
 [140] dll vendor 12 bytes {0} [built]
 [179] (webpack)/buildin/module.js 517 bytes {0} [built]
    + 379 hidden modules
 91% additional asset processingnpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! strapi-admin@3.0.0-alpha.23.1 build: `APP_PATH=$APP_PATH npm run build:dll && node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production IS_ADMIN=true node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the strapi-admin@3.0.0-alpha.23.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Steps to reproduce the problem npm run setup

What is the expected behavior? A successful compile.

Suggested solutions To maybe not do this?

derrickmehaffy commented 5 years ago

Your reported version and the one in your logs are older than the current please test using the latest version of Strapi.

I am marking as closed for now due to the old versions.

selfagency commented 5 years ago

what does that even mean?? how could i have two mismatched versions?

{
  "devDependencies": {
    "babel-eslint": "^7.1.1",
    "eslint": "^4.19.1",
    "eslint-config-airbnb": "^13.0.0",
    "eslint-config-prettier": "^4.1.0",
    "eslint-config-standard": "^12.0.0",
    "eslint-plugin-import": "^2.11.0",
    "eslint-plugin-node": "^8.0.1",
    "eslint-plugin-prettier": "^3.0.1",
    "eslint-plugin-promise": "^4.1.1",
    "eslint-plugin-react": "^7.7.0",
    "eslint-plugin-security": "^1.4.0",
    "eslint-plugin-standard": "^4.0.0",
    "ora": "^3.4.0",
    "prettier": "^1.16.4",
    "sh-exec": "^2.1.0"
  },
  "dependencies": {
    "@sentry/node": "^5.0.5",
    "envkey": "^1.2.6",
    "knex": "latest",
    "lodash": "^4.17.5",
    "pg": "^7.8.1",
    "strapi": "^3.0.0-alpha.24.1",
    "strapi-hook-bookshelf": "3.0.0-alpha.23.1",
    "strapi-hook-knex": "3.0.0-alpha.23.1",
    "strapi-provider-email-mailgun": "^3.0.0-alpha.15",
    "strapi-provider-upload-wasabi": "^0.2.0"
  }
}
derrickmehaffy commented 5 years ago

Your package.json

    "strapi": "^3.0.0-alpha.24.1",
    "strapi-hook-bookshelf": "3.0.0-alpha.23.1",
    "strapi-hook-knex": "3.0.0-alpha.23.1",
    "strapi-provider-email-mailgun": "^3.0.0-alpha.15",

Your reported version: Strapi version: 3.0.0-alpha.24.1

Current version: https://github.com/strapi/strapi/releases/tag/v3.0.0-alpha.25.2

Please test using the latest version, also what are you trying to use npm run setup on the project level for?

derrickmehaffy commented 5 years ago

Strapi plugin versions directly match the strapi versions if they are built by Strapi, and example of one which is not is the "strapi-provider-upload-wasabi": "^0.2.0" which is fine but all your Strapi based plugins need to be updated. I would recommend that you take a look through the migration guides: https://strapi.io/documentation/3.x.x/migration-guide/

Or use my method to "cleanly" update your project: https://github.com/strapi/strapi/issues/1880

selfagency commented 5 years ago

Ok so I upgraded to 3.0.0-alpha.25.2 and... now it's worse.

➜ set -gx NODE_ENV production; npm install --production --debug; npm run setup --debug

> strapi@3.0.0-alpha.25.2 postinstall /apps/kifa-cms/node_modules/strapi
> node lib/utils/success.js

> kifa-cms@0.1.0 postinstall /apps/kifa-cms
> node node_modules/strapi/lib/utils/post-install.js

πŸ”Έ  Administration Panel
πŸ“¦  Installing packages...
βœ…  Success

πŸ”Έ  Plugin - Content-manager
πŸ“¦  Installing packages...
βœ…  Success

πŸ”Έ  Plugin - Content-type-builder
πŸ“¦  Installing packages...
βœ…  Success

πŸ”Έ  Plugin - Email
πŸ“¦  Installing packages...
βœ…  Success

πŸ”Έ  Plugin - Settings-manager
πŸ“¦  Installing packages...
βœ…  Success

πŸ”Έ  Plugin - Upload
πŸ“¦  Installing packages...
βœ…  Success

πŸ”Έ  Plugin - Users-permissions
πŸ“¦  Installing packages...
βœ…  Success

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 632 packages from 486 contributors and audited 11781 packages in 93.672s
found 7 vulnerabilities (5 low, 2 moderate)
  run `npm audit fix` to fix them, or `npm audit` for details

> kifa-cms@0.1.0 setup /apps/kifa-cms
> cd admin && npm run setup

> strapi-admin@3.0.0-alpha.25.2 presetup /apps/kifa-cms/admin
> node ./scripts/preSetup.js

πŸ•“  The setup process can take few minutes.

πŸ”Έ  Administration Panel
πŸ“¦  Installing packages...

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN bookshelf@0.12.1 requires a peer of knex@>=0.6.10 <0.15.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-ga@2.5.7 requires a peer of react@^15.6.2 || ^16.0 but none is installed. You must install peer dependencies yourself.
npm WARN video-react@0.13.6 requires a peer of react@^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN video-react@0.13.6 requires a peer of react-dom@^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb@17.1.0 requires a peer of eslint-plugin-jsx-a11y@^6.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 11781 packages in 12.923s
found 7 vulnerabilities (5 low, 2 moderate)
  run `npm audit fix` to fix them, or `npm audit` for details
npm WARN deprecated react-router-redux@5.0.0-alpha.9: This project is no longer maintained.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN bootstrap@4.3.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.

audited 1468 packages in 5.71s
found 0 vulnerabilities

cd: no such file or directory: /apps/kifa-cms/admin/node_modules/strapi-helper-plugin
audited 1468 packages in 3.176s
found 0 vulnerabilities

Packages installed successfully

> strapi-admin@3.0.0-alpha.25.2 setup /apps/kifa-cms/admin
> node ./scripts/setup.js

πŸ—  Building the admin...
/bin/sh: 1: cross-env: not found
/bin/sh: 1: cross-env: not found

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! strapi-admin@3.0.0-alpha.25.2 setup: `node ./scripts/setup.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the strapi-admin@3.0.0-alpha.25.2 setup 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!     /home/selfagency/.npm/_logs/2019-04-07T22_17_28_089Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! kifa-cms@0.1.0 setup: `cd admin && npm run setup`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the kifa-cms@0.1.0 setup 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!     /home/selfagency/.npm/_logs/2019-04-07T22_17_28_110Z-debug.log
selfagency commented 5 years ago

admin/package.json πŸ€”

  "devDependencies": {
    "cross-env": "^5.0.5",
    "sanitize.css": "^4.1.0",
    "strapi-helper-plugin": "3.0.0-alpha.25.2",
    "strapi-utils": "3.0.0-alpha.25.2"
  },
derrickmehaffy commented 5 years ago

@selfagency What are you trying to use npm run setup for exactly? You can't currently rebuild the adminUI at the project level if that is what you are trying to do.

selfagency commented 5 years ago

I appear to have been under the mistaken assumption that it was a necessary installation step.

derrickmehaffy commented 5 years ago

@selfagency nope :smile: If you hit issues make sure you delete the package-lock.json file in the root of your directory, you can also add package-lock=false to a file called .npmrc in the root of your project to stop node from generating this file.

All you need to do to deploy your project is clone it, cd to it's root, and run npm i then use whatever method you want to run it. (I recommend pm2)

edit: right now there is no "build" step as when you generate a project it is "built" (that is the adminUI stuff) and you actually can't "rebuild" it yet (that is being worked on at the project level)

selfagency commented 5 years ago

Gotcha, thanks

TheRoccoB commented 5 years ago

killing package-lock worked for me!

secretlifeof commented 5 years ago

I am also experiencing an error:

54% building modules 369/382 modules 13 active ...ules/core-js/modulenpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! strapi-admin@3.0.0-alpha.26.2 setup: `node ./scripts/setup.js`
npm ERR! Exit status 1

Just to be clear npm run setup is not needed even if the environment settings are changed? Just npm install from root folder?

https://strapi.io/documentation/3.x.x/guides/deployment.html#configuration

Versions: strapi: "3.0.0-alpha.26.2" strapi-utils: "3.0.0-alpha.26.2" strapi-hook-bookshelf: "3.0.0-alpha.26.2" Strapi-hook-knew: "3.0.0-alpha.26.2"

cg219 commented 5 years ago

I've run into a similar problem. On first install it works fine. But I want to change my admin path for security reasons. The Docs said if I change something in the server.json I need to run npm run setup.

Has there been any answers for these??


37% building modules 227/270 modules 43 active .../src/containers/AdminPage/styles.scssnpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! strapi-admin@3.0.0-alpha.26.2 build: `cross-env APP_PATH=$APP_PATH npm run build:dll && cross-env NODE_ENV=production IS_ADMIN=true ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the strapi-admin@3.0.0-alpha.26.2 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.```
wcwung commented 5 years ago

@cg219 Bumping up the memory on my VPS fixed this for me. Looks like npm run setup uses a lot of memory and can OOM your VPS if you're on a low tier. A simple restart of your server might even be enough to free up some memory.

dearprakash commented 4 years ago

The errors were misleading [2019-11-23T11:00:51.028Z] debug ⛔️ Server wasn't able to start properly. [2019-11-23T11:00:51.029Z] error ReferenceError: URL is not defined But as mentioned above, node version 10 was key reason in my case. I had multiple versions of node and for strapi, `

lauriejim commented 4 years ago

Hello! Can you upgrade your Node.js version.

dobradovic commented 3 years ago

Hello,

I'm getting npm ERR! missing script: build - when I try with command npn run build to start exiting project locally.

Any advice? Tnx! :)