Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not install nativescript specific version 6.x.x #5747

Open
3 tasks done
minhson95th opened this issue Jul 11, 2023 · 2 comments
Open
3 tasks done

Can not install nativescript specific version 6.x.x #5747

minhson95th opened this issue Jul 11, 2023 · 2 comments

Comments

@minhson95th
Copy link

Issue Description

I try to install nativescript version 6.5.1 look like this
npm i -g [email protected]
But cmd return error:
npm ERR! code EINTEGRITY
npm ERR! sha512-bf7UQUo6n0c3Fxn5OXckpausCWjFg+qGLzN/LnaMsjF+9HYuSMbPPciWI6zPLu+KLnwjqwKzwPkozi/vxJYpvw== integrity checksum failed when using sha512: wanted sha512-bf7UQUo6n0c3Fxn5OXckpausCWjFg+qGLzN/LnaMsjF+9HYuSMbPPciWI6zPLu+KLnwjqwKzwPkozi/vxJYpvw== but got sha512-wyGWHP4AFW67EKazxHpKOCPu8cTK5mZSL5eXrLl0OFBoEY46wQLFgtVrPiBjrUp4rGg8fXnLUiRsoVSlgQAndw==. (15534 bytes)

Reproduction

No response

Relevant log output (if applicable)

No response

Environment

No response

Please accept these terms

@minhson95th minhson95th added the bug-pending-triage Reported bug, pending triage to confirm. label Jul 11, 2023
@minhson95th minhson95th changed the title Can not install nativescript specific version Can not install nativescript specific version 6.x.x Jul 11, 2023
@rigor789
Copy link
Member

Use a newer CLI version, preferably the latest - it should be backwards compatible with older projects (in most cases).

The issue is that some npm packages got moved/renamed over the years (6.5.1 was released 3 years ago) and cause shasums to mismatch. There's nothing we can do to fix the already released versions on the registry apart from publishing a new/patch version, however given these are more than 3 years old it's unlikely to happen.

A similar issue was reported for 6.8.0 and we did release a fix in 6.8.1 (#5719)

A possible workaround is provided in #5469

@rigor789 rigor789 removed the bug-pending-triage Reported bug, pending triage to confirm. label Jul 11, 2023
@rigor789 rigor789 transferred this issue from NativeScript/NativeScript Jul 11, 2023
@flipperlite
Copy link

flipperlite commented Mar 6, 2024

I also had an NS 6.8.1 project recently worked on. It can work if you install it local to your project and not globally. Some of the fix was taken from this issue. These instructions can work with global NS 8.x installed in parallel to your local project. I find that Node 14 is the most recent version that supports NS 6 without issue. Therefore, you need to have NVM installed to allow you to easily switch Node versions. I also have the alias line below added to my ~/.zshrc file to load on terminal start.

I would view this as a stop gap only as @rigor789 said and find a way to migrate ASAP the latest of NS. You'll not only live in dependency hell but also deal with new plugins that you want to use like @nativescript-community/perms not backwards compatible with NS6 and/or Node 14.

cd my-project (or whatever your project location is)
command -v nvm (confirm nvm works)
nvm install 14
nvm use 14
npm install --save-dev 'https://github.com/telerik/cli-table/tarball/v0.3.1.2'
npm install --save-dev 'https://github.com/NativeScript/marked-terminal/tarball/v3.1.1n'
npm install --save-dev [email protected]
rm -rf node_modules package-lock.json
npm install
alias tns='nvm use 14 && ./node_modules/.bin/tns'
tns doctor
tns run ios
tns run android

Expanding that idea, you could have a Node version to match each NS version using alias. I believe the naming went from tns to ns at NS 7 but change accordingly. Your single machine can now support multiple Node and NS environments simultaneously.

alias ns6='nvm use 14 && ./node_modules/.bin/tns'
ns6 doctor
ns6 run ios
ns6 run android

alias ns7='nvm use 16 && ./node_modules/.bin/ns'
ns7 doctor
ns7 run ios
ns7 run android

alias ns8='nvm use 20 && ./node_modules/.bin/ns'
ns8 doctor
ns8 run ios
ns8 run android

You may find that your dependencies are broken too. I had to remove some old ones and use newer ones but not the most recent ones. For example, sass-loader version 8.x only works on Node 16 and breaks on Node 14 (my highest version of Node due to NS 6.x dependency) resulting in me using version 7.x below. Here's my package.json file with the latest versions that will work with NS 6.8.1.

    "nativescript": {
        "id": "com.foo.bar",
        "tns-android": {
            "version": "6.5.3"
        },
        "tns-ios": {
            "version": "6.5.6"
        }
    },
    "dependencies": {
        "@nstudio/nativescript-checkbox": "^1.0.0",
        "email-validator": "^2.0.4",
        "json-schema-defaults": "^0.4.0",
        "moment": "^2.28.0",
        "nativescript-iqkeyboardmanager": "^1.5.1",
        "nativescript-plugin-firebase": "^10.5.2",
        "nativescript-theme-core": "^1.0.4",
        "nativescript-ui-sidedrawer": "^6.0.0",
        "tns-core-modules": "6.5.27"
    },
    "devDependencies": {
        "babel-traverse": "6.26.0",
        "babel-types": "6.26.0",
        "babylon": "6.18.0",
        "cli-table": "https://github.com/telerik/cli-table/tarball/v0.3.1.2",
        "eslint": "^5.16.0",
        "lazy": "1.0.11",
        "marked-terminal": "https://github.com/NativeScript/marked-terminal/tarball/v3.1.1n",
        "nativescript": "^6.8.1",
        "nativescript-dev-webpack": "^1.5.1",
        "sass": "^1.71.1",
        "sass-loader": "^7.3.1",
        "should": "^11.1.2",
        "sinon": "^1.17.6",
        "tns-android": "6.5.3",
        "tns-ios": "6.5.6"
    }

My webpack.config.js with changes to SCSS compiler.

        module: {
            rules: [
                {
                    include: join(appFullPath, entryPath),
                    use: [
                        // Require all Android app components
                        platform === "android" && {
                            loader: "nativescript-dev-webpack/android-app-components-loader",
                            options: { modules: appComponents }
                        },

                        {
                            loader: "nativescript-dev-webpack/bundle-config-loader",
                            options: {
                                loadCss: !snapshot, // load the application css if in debug mode
                                unitTesting,
                                appFullPath,
                                projectRoot,
                                ignoredFiles: nsWebpack.getUserDefinedEntries(entries, platform)
                            }
                        },
                    ].filter(loader => !!loader)
                },

                {
                    test: /\.(js|css|scss|html|xml)$/,
                    use: "nativescript-dev-webpack/hmr/hot-loader"
                },

                { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" },

                {
                    test: /\.css$/,
                    use: "nativescript-dev-webpack/css2json-loader"
                },

                {
                    test: /\.scss$/,
                    use: [
                        { loader: "css-loader", options: { url: false } },
                        "sass-loader"
                    ]
                },
            ]
        },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants